@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->echoCLI = config('nntmux.echocli'); |
111 | 111 | $groupID = ''; |
112 | 112 | |
113 | - if (! empty($groupName)) { |
|
113 | + if (!empty($groupName)) { |
|
114 | 114 | $groupInfo = UsenetGroup::getByName($groupName); |
115 | 115 | if ($groupInfo !== null) { |
116 | 116 | $groupID = $groupInfo['id']; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); |
122 | 122 | } |
123 | 123 | |
124 | - if (! file_exists(Settings::settingValue('..nzbpath'))) { |
|
124 | + if (!file_exists(Settings::settingValue('..nzbpath'))) { |
|
125 | 125 | if ($this->echoCLI) { |
126 | 126 | $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')); |
127 | 127 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $cat = new Categorize(); |
183 | 183 | $categorized = $total = 0; |
184 | 184 | $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]); |
185 | - if (! empty($groupId)) { |
|
185 | + if (!empty($groupId)) { |
|
186 | 186 | $releasesQuery->where('groups_id', $groupId); |
187 | 187 | } |
188 | 188 | $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get(); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $this->colorCLI->header('Process Releases -> Attempting to find complete collections.'); |
219 | 219 | } |
220 | 220 | |
221 | - $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
221 | + $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
222 | 222 | |
223 | 223 | $this->processStuckCollections($groupID); |
224 | 224 | $this->collectionFileCheckStage1($groupID); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($this->echoCLI) { |
232 | 232 | $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART); |
233 | 233 | |
234 | - if (! empty($groupID)) { |
|
234 | + if (!empty($groupID)) { |
|
235 | 235 | $countQuery->where('groups_id', $groupID); |
236 | 236 | } |
237 | 237 | $count = $countQuery->count('id'); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).'); |
259 | 259 | } |
260 | 260 | // Get the total size in bytes of the collection for collections where filecheck = 2. |
261 | - DB::transaction(function () use ($groupID, $startTime) { |
|
261 | + DB::transaction(function() use ($groupID, $startTime) { |
|
262 | 262 | $checked = DB::update( |
263 | 263 | sprintf( |
264 | 264 | ' |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | AND c.filesize = 0 %s', |
275 | 275 | self::COLLFC_SIZED, |
276 | 276 | self::COLLFC_COMPPART, |
277 | - (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
277 | + (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
278 | 278 | ) |
279 | 279 | ); |
280 | 280 | if ($checked > 0 && $this->echoCLI) { |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | |
314 | 314 | $groupMinimums = UsenetGroup::getGroupByID($grpID['id']); |
315 | 315 | if ($groupMinimums !== null) { |
316 | - if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
316 | + if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
317 | 317 | $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease']; |
318 | 318 | } |
319 | - if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
319 | + if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
320 | 320 | $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) { |
325 | - DB::transaction(function () use ( |
|
325 | + DB::transaction(function() use ( |
|
326 | 326 | $groupMinSizeSetting, |
327 | 327 | $minSizeSetting, |
328 | 328 | $minSizeDeleted, |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $collectionsQuery = Collection::query() |
396 | 396 | ->where('collections.filecheck', self::COLLFC_SIZED) |
397 | 397 | ->where('collections.filesize', '>', 0); |
398 | - if (! empty($groupID)) { |
|
398 | + if (!empty($groupID)) { |
|
399 | 399 | $collectionsQuery->where('collections.groups_id', $groupID); |
400 | 400 | } |
401 | 401 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $releaseID = Release::insertRelease( |
451 | 451 | [ |
452 | 452 | 'name' => $cleanRelName, |
453 | - 'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
453 | + 'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
454 | 454 | 'totalpart' => $collection->totalfiles, |
455 | 455 | 'groups_id' => $collection->groups_id, |
456 | 456 | 'guid' => createGUID(), |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | if ($releaseID !== null) { |
468 | 468 | // Update collections table to say we inserted the release. |
469 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
469 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
470 | 470 | Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); |
471 | 471 | }, 10); |
472 | 472 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | } |
528 | 528 | } else { |
529 | 529 | // The release was already in the DB, so delete the collection. |
530 | - DB::transaction(static function () use ($collection) { |
|
530 | + DB::transaction(static function() use ($collection) { |
|
531 | 531 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
532 | 532 | }, 10); |
533 | 533 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0); |
571 | - if (! empty($groupID)) { |
|
571 | + if (!empty($groupID)) { |
|
572 | 572 | $releasesQuery->where('releases.groups_id', $groupID); |
573 | 573 | } |
574 | 574 | $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get(); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | ), true); |
672 | 672 | } |
673 | 673 | |
674 | - DB::transaction(function () use ($deletedCount, $startTime) { |
|
674 | + DB::transaction(function() use ($deletedCount, $startTime) { |
|
675 | 675 | $deleted = 0; |
676 | 676 | $deleteQuery = Collection::query() |
677 | 677 | ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours'))) |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | $releases = Release::query() |
835 | 835 | ->select(['id', 'guid']) |
836 | 836 | ->where('passwordstatus', '=', Releases::PASSWD_RAR) |
837 | - ->orWhereIn('id', function ($query) { |
|
837 | + ->orWhereIn('id', function($query) { |
|
838 | 838 | $query->select('releases_id') |
839 | 839 | ->from('release_files') |
840 | 840 | ->where('passworded', '=', Releases::PASSWD_RAR); |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | foreach ($genrelist as $genre) { |
894 | 894 | $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']); |
895 | 895 | $releases = Release::query() |
896 | - ->joinSub($musicInfoQuery, 'mi', function ($join) { |
|
896 | + ->joinSub($musicInfoQuery, 'mi', function($join) { |
|
897 | 897 | $join->on('releases.musicinfo_id', '=', 'mi.id'); |
898 | 898 | }) |
899 | 899 | ->select(['releases.id', 'releases.guid']) |
@@ -979,18 +979,18 @@ discard block |
||
979 | 979 | */ |
980 | 980 | private function collectionFileCheckStage1(int $groupID): void |
981 | 981 | { |
982 | - DB::transaction(static function () use ($groupID) { |
|
982 | + DB::transaction(static function() use ($groupID) { |
|
983 | 983 | $collectionsCheck = Collection::query()->select(['collections.id']) |
984 | 984 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
985 | 985 | ->where('collections.totalfiles', '>', 0) |
986 | 986 | ->where('collections.filecheck', '=', self::COLLFC_DEFAULT); |
987 | - if (! empty($groupID)) { |
|
987 | + if (!empty($groupID)) { |
|
988 | 988 | $collectionsCheck->where('collections.groups_id', $groupID); |
989 | 989 | } |
990 | 990 | $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id') |
991 | 991 | ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)'); |
992 | 992 | |
993 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
993 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
994 | 994 | $join->on('collections.id', '=', 'r.id'); |
995 | 995 | })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]); |
996 | 996 | }, 10); |
@@ -1011,25 +1011,25 @@ discard block |
||
1011 | 1011 | */ |
1012 | 1012 | private function collectionFileCheckStage2(int $groupID): void |
1013 | 1013 | { |
1014 | - DB::transaction(static function () use ($groupID) { |
|
1014 | + DB::transaction(static function() use ($groupID) { |
|
1015 | 1015 | $collectionsCheck = Collection::query()->select(['collections.id']) |
1016 | 1016 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
1017 | 1017 | ->where('binaries.filenumber', '=', 0) |
1018 | 1018 | ->where('collections.totalfiles', '>', 0) |
1019 | 1019 | ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL); |
1020 | - if (! empty($groupID)) { |
|
1020 | + if (!empty($groupID)) { |
|
1021 | 1021 | $collectionsCheck->where('collections.groups_id', $groupID); |
1022 | 1022 | } |
1023 | 1023 | $collectionsCheck->groupBy('collections.id'); |
1024 | 1024 | |
1025 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
1025 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
1026 | 1026 | $join->on('collections.id', '=', 'r.id'); |
1027 | 1027 | })->update(['collections.filecheck' => self::COLLFC_ZEROPART]); |
1028 | 1028 | }, 10); |
1029 | 1029 | |
1030 | - DB::transaction(static function () use ($groupID) { |
|
1030 | + DB::transaction(static function() use ($groupID) { |
|
1031 | 1031 | $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL); |
1032 | - if (! empty($groupID)) { |
|
1032 | + if (!empty($groupID)) { |
|
1033 | 1033 | $collectionQuery->where('groups_id', $groupID); |
1034 | 1034 | } |
1035 | 1035 | $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]); |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | */ |
1048 | 1048 | private function collectionFileCheckStage3(string $where): void |
1049 | 1049 | { |
1050 | - DB::transaction(static function () use ($where) { |
|
1050 | + DB::transaction(static function() use ($where) { |
|
1051 | 1051 | DB::update( |
1052 | 1052 | sprintf( |
1053 | 1053 | ' |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | ); |
1072 | 1072 | }, 10); |
1073 | 1073 | |
1074 | - DB::transaction(static function () use ($where) { |
|
1074 | + DB::transaction(static function() use ($where) { |
|
1075 | 1075 | DB::update( |
1076 | 1076 | sprintf( |
1077 | 1077 | ' |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | */ |
1109 | 1109 | private function collectionFileCheckStage4(string &$where): void |
1110 | 1110 | { |
1111 | - DB::transaction(static function () use ($where) { |
|
1111 | + DB::transaction(static function() use ($where) { |
|
1112 | 1112 | DB::update( |
1113 | 1113 | sprintf( |
1114 | 1114 | ' |
@@ -1138,9 +1138,9 @@ discard block |
||
1138 | 1138 | */ |
1139 | 1139 | private function collectionFileCheckStage5(int $groupId): void |
1140 | 1140 | { |
1141 | - DB::transaction(static function () use ($groupId) { |
|
1141 | + DB::transaction(static function() use ($groupId) { |
|
1142 | 1142 | $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]); |
1143 | - if (! empty($groupId)) { |
|
1143 | + if (!empty($groupId)) { |
|
1144 | 1144 | $collectionQuery->where('groups_id', $groupId); |
1145 | 1145 | } |
1146 | 1146 | $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | */ |
1159 | 1159 | private function collectionFileCheckStage6(string &$where): void |
1160 | 1160 | { |
1161 | - DB::transaction(function () use ($where) { |
|
1161 | + DB::transaction(function() use ($where) { |
|
1162 | 1162 | DB::update( |
1163 | 1163 | sprintf( |
1164 | 1164 | " |
@@ -1188,10 +1188,10 @@ discard block |
||
1188 | 1188 | { |
1189 | 1189 | $lastRun = Settings::settingValue('indexer.processing.last_run_time'); |
1190 | 1190 | |
1191 | - DB::transaction(function () use ($groupID, $lastRun) { |
|
1191 | + DB::transaction(function() use ($groupID, $lastRun) { |
|
1192 | 1192 | $objQuery = Collection::query() |
1193 | 1193 | ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout)); |
1194 | - if (! empty($groupID)) { |
|
1194 | + if (!empty($groupID)) { |
|
1195 | 1195 | $objQuery->where('groups_id', $groupID); |
1196 | 1196 | } |
1197 | 1197 | $obj = $objQuery->delete(); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | Paginator::useBootstrapFive(); |
18 | 18 | $smarty = app('smarty.view'); |
19 | 19 | view()->share('smarty', $smarty); |
20 | - Gate::define('viewPulse', function (User $user) { |
|
20 | + Gate::define('viewPulse', function(User $user) { |
|
21 | 21 | return $user->hasRole('Admin'); |
22 | 22 | }); |
23 | 23 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (empty($email) && empty($rssToken)) { |
47 | 47 | app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset'); |
48 | 48 | } else { |
49 | - if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { |
|
49 | + if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) { |
|
50 | 50 | $this->validate($request, [ |
51 | 51 | 'g-recaptcha-response' => 'required|captcha', |
52 | 52 | ]); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // |
55 | 55 | // Check users exists and send an email |
56 | 56 | // |
57 | - $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
57 | + $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
58 | 58 | if ($ret === null) { |
59 | 59 | app('smarty.view')->assign('error', 'The email or apikey are not recognised.'); |
60 | 60 | $sent = true; |
@@ -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 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | 'false', |
35 | 35 | ]; |
36 | 36 | |
37 | -if (! isset($argv[1], $argv[2]) || ! in_array($argv[1], $args, false) || ! in_array($argv[2], $bool, false)) { |
|
37 | +if (!isset($argv[1], $argv[2]) || !in_array($argv[1], $args, false) || !in_array($argv[2], $bool, false)) { |
|
38 | 38 | exit( |
39 | 39 | (new Blacklight\ColorCLI())->error( |
40 | 40 | "\nIncorrect arguments.\n" |
@@ -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. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->colorCli = new ColorCLI(); |
75 | 75 | |
76 | 76 | $this->tmpPath = config('nntmux.tmp_unrar_path'); |
77 | - if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
77 | + if (!preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
78 | 78 | $this->tmpPath .= '/'; |
79 | 79 | } |
80 | 80 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $size = \strlen($possibleNFO); |
136 | 136 | if ($size < 65535 && |
137 | 137 | $size > 11 && |
138 | - ! preg_match( |
|
138 | + !preg_match( |
|
139 | 139 | '/\A(\s*<\?xml|=newz\[NZB\]=|RIFF|\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\s*Generated\s*by.*SF\w/i', |
140 | 140 | $possibleNFO |
141 | 141 | )) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | // Linux boxes have 'file' (so should Macs), Windows *can* have it too: see GNUWIN.txt in docs. |
147 | 147 | $result = Utility::fileInfo($tmpPath); |
148 | - if (! empty($result)) { |
|
148 | + if (!empty($result)) { |
|
149 | 149 | // Check if it's text. |
150 | 150 | if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\s*text/', $result)) { |
151 | 151 | @File::delete($tmpPath); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | Release::whereId($release->id)->update(['nfostatus' => self::NFO_FOUND]); |
205 | 205 | |
206 | - if (! isset($release->completion)) { |
|
206 | + if (!isset($release->completion)) { |
|
207 | 207 | $release->completion = 0; |
208 | 208 | } |
209 | 209 |