@@ -19,18 +19,18 @@ |
||
19 | 19 | */ |
20 | 20 | public function release(Request $request): \Illuminate\Http\JsonResponse |
21 | 21 | { |
22 | - $releaseObName = $request->has('relo') && ! empty($request->input('relo')) ? $request->input('relo') : ''; |
|
23 | - $releasePrName = $request->has('relp') && ! empty($request->input('relp')) ? $request->input('relp') : ''; |
|
24 | - $apiToken = $request->has('api_token') && ! empty($request->input('api_token')) ? $request->input('api_token') : ''; |
|
22 | + $releaseObName = $request->has('relo') && !empty($request->input('relo')) ? $request->input('relo') : ''; |
|
23 | + $releasePrName = $request->has('relp') && !empty($request->input('relp')) ? $request->input('relp') : ''; |
|
24 | + $apiToken = $request->has('api_token') && !empty($request->input('api_token')) ? $request->input('api_token') : ''; |
|
25 | 25 | $user = User::query()->where('api_token', $request->input('api_token'))->first(); |
26 | - if (! $user) { |
|
26 | + if (!$user) { |
|
27 | 27 | return response()->json(['message' => 'Indexer inform error, wrong api key!'], 404); |
28 | 28 | } |
29 | 29 | |
30 | - if (! empty($releaseObName) && ! empty($releasePrName) && ! empty($apiToken)) { |
|
30 | + if (!empty($releaseObName) && !empty($releasePrName) && !empty($apiToken)) { |
|
31 | 31 | ReleaseInform::insertOrIgnore(['relOName' => $releaseObName, 'relPName' => $releasePrName, 'api_token' => $apiToken, 'created_at' => now(), 'updated_at' => now()]); |
32 | 32 | $release = Release::whereSearchname($releaseObName)->first(); |
33 | - if (! empty($release)) { |
|
33 | + if (!empty($release)) { |
|
34 | 34 | (new NameFixer)->updateRelease($release, $releasePrName, 'Release Inform API', true, 'Filenames, ', 1, true); |
35 | 35 | } |
36 | 36 |
@@ -196,7 +196,7 @@ |
||
196 | 196 | return $predb; |
197 | 197 | } |
198 | 198 | $sql = self::query()->leftJoin('releases', 'releases.predb_id', '=', 'predb.id')->orderByDesc('predb.predate'); |
199 | - if (! empty($search)) { |
|
199 | + if (!empty($search)) { |
|
200 | 200 | if (config('nntmux.elasticsearch_enabled') === true) { |
201 | 201 | $ids = (new ElasticSearchSiteSearch)->predbIndexSearch($search); |
202 | 202 | } else { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function handle(): void |
38 | 38 | { |
39 | 39 | // Check if any options are false |
40 | - if (! $this->option('notindb') && ! $this->option('notondisk')) { |
|
40 | + if (!$this->option('notindb') && !$this->option('notondisk')) { |
|
41 | 41 | $this->error('You must specify at least one option. See: --help'); |
42 | 42 | exit(); |
43 | 43 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $guid = stristr($filePath->getFilename(), '.nzb.gz', true); |
64 | 64 | if (File::isFile($filePath) && $guid) { |
65 | 65 | // If NZB file guid is not present in DB delete the file from disk |
66 | - if (! $releases->whereGuid($guid)->exists()) { |
|
66 | + if (!$releases->whereGuid($guid)->exists()) { |
|
67 | 67 | if ($delete) { |
68 | 68 | File::delete($filePath); |
69 | 69 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $total = Release::count(); |
89 | 89 | $this->alert("Total releases to check: $total"); |
90 | 90 | |
91 | - Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function (Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
91 | + Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function(Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
92 | 92 | echo 'Total done: '.$checked."\r"; |
93 | 93 | foreach ($releases as $r) { |
94 | 94 | |
95 | - if (! $nzb->NZBPath($r->guid)) { |
|
95 | + if (!$nzb->NZBPath($r->guid)) { |
|
96 | 96 | if ($delete) { |
97 | 97 | $rel->deleteSingle(['g' => $r->guid, 'i' => $r->id], $nzb, new ReleaseImage); |
98 | 98 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | return $movie; |
83 | 83 | } |
84 | 84 | $sql = self::query()->select('*'); |
85 | - if (! empty($search)) { |
|
85 | + if (!empty($search)) { |
|
86 | 86 | $sql->whereLike('title', '%'.$search.'%'); |
87 | 87 | } |
88 | 88 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | Paginator::useBootstrapFive(); |
21 | 21 | $smarty = app('smarty.view'); |
22 | 22 | view()->share('smarty', $smarty); |
23 | - Gate::define('viewPulse', function (User $user) { |
|
23 | + Gate::define('viewPulse', function(User $user) { |
|
24 | 24 | return $user->hasRole('Admin'); |
25 | 25 | }); |
26 | 26 | Event::listen(Login::class, LoginViaRemember::class); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // Get the default user role. |
148 | 148 | $userDefault = Role::query()->where('isdefault', '=', 1)->first(); |
149 | 149 | |
150 | - if (! empty($error)) { |
|
150 | + if (!empty($error)) { |
|
151 | 151 | return $this->showRegistrationForm($request, $error); |
152 | 152 | } |
153 | 153 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | break; |
171 | 171 | case 'view': |
172 | 172 | // See if it is a valid invite. |
173 | - if (($inviteCode !== null) && ! Invite::isValid($inviteCode)) { |
|
173 | + if (($inviteCode !== null) && !Invite::isValid($inviteCode)) { |
|
174 | 174 | $error = 'Invalid invitation token!'; |
175 | 175 | $showRegister = 0; |
176 | 176 | } else { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | if ((int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
205 | - if (! empty($inviteCode)) { |
|
205 | + if (!empty($inviteCode)) { |
|
206 | 206 | if (Invite::isValid($inviteCode)) { |
207 | 207 | $error = ''; |
208 | 208 | $showRegister = 1; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // convert from a string array to an int array as we want to use int |
152 | - $book_reqids_ids = array_map(function ($value) { |
|
152 | + $book_reqids_ids = array_map(function($value) { |
|
153 | 153 | return (int) $value; |
154 | 154 | }, $book_reqids_ids); |
155 | 155 | $this->smarty->assign('book_reqids_ids', $book_reqids_ids); |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $books_selected = explode(',', Settings::settingValue('book_reqids')); |
160 | 160 | |
161 | 161 | // convert from a string array to an int array |
162 | - $books_selected = array_map(function ($value) { |
|
162 | + $books_selected = array_map(function($value) { |
|
163 | 163 | return (int) $value; |
164 | 164 | }, $books_selected); |
165 | 165 | $this->smarty->assign('book_reqids_selected', $books_selected); |
166 | 166 | |
167 | 167 | $this->smarty->assign('themelist', Utility::getThemesList()); |
168 | 168 | |
169 | - if (! str_contains(config('settings.nntp_server'), 'astra')) { |
|
169 | + if (!str_contains(config('settings.nntp_server'), 'astra')) { |
|
170 | 170 | $this->smarty->assign('compress_headers_warning', 'compress_headers_warning'); |
171 | 171 | } |
172 | 172 |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | { |
255 | 255 | $res = self::query()->where('email', '<>', '[email protected]'); |
256 | 256 | |
257 | - if (! empty($role)) { |
|
257 | + if (!empty($role)) { |
|
258 | 258 | $res->where('roles_id', $role); |
259 | 259 | } |
260 | 260 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
296 | 296 | ]; |
297 | 297 | |
298 | - if (! empty($email)) { |
|
298 | + if (!empty($email)) { |
|
299 | 299 | $email = trim($email); |
300 | 300 | $sql += ['email' => $email]; |
301 | 301 | } |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | { |
345 | 345 | $user = self::find($uid); |
346 | 346 | $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString(); |
347 | - if (! empty($date)) { |
|
347 | + if (!empty($date)) { |
|
348 | 348 | $user->update(['rolechangedate' => $date]); |
349 | 349 | } |
350 | - if (empty($date) && ! empty($addYear)) { |
|
350 | + if (empty($date) && !empty($addYear)) { |
|
351 | 351 | $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]); |
352 | 352 | } |
353 | 353 | } |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | return self::fromQuery( |
405 | 405 | sprintf( |
406 | 406 | $query, |
407 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
408 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
409 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
410 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
407 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
408 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
409 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
410 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
411 | 411 | $order[0], |
412 | 412 | $order[1], |
413 | 413 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | public static function isValidUrl($url): bool |
521 | 521 | { |
522 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
522 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
557 | 557 | $invitedBy = 0; |
558 | - if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
558 | + if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
559 | 559 | if ($inviteCode === '') { |
560 | 560 | return self::ERR_SIGNUP_BADINVITECODE; |
561 | 561 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | public static function checkAndUseInvite(string $inviteCode): int |
576 | 576 | { |
577 | 577 | $invite = Invitation::getInvite($inviteCode); |
578 | - if (! $invite) { |
|
578 | + if (!$invite) { |
|
579 | 579 | return -1; |
580 | 580 | } |
581 | 581 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
592 | 592 | { |
593 | 593 | $password = self::hashPassword($password); |
594 | - if (! $password) { |
|
594 | + if (!$password) { |
|
595 | 595 | return false; |
596 | 596 | } |
597 | 597 | |
@@ -633,9 +633,9 @@ discard block |
||
633 | 633 | |
634 | 634 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
635 | 635 | |
636 | - if (! empty($allowed)) { |
|
636 | + if (!empty($allowed)) { |
|
637 | 637 | foreach ($cats as $cat) { |
638 | - if (! \in_array($cat, $allowed, false)) { |
|
638 | + if (!\in_array($cat, $allowed, false)) { |
|
639 | 639 | $ret[] = match ($cat) { |
640 | 640 | 'view console' => 1000, |
641 | 641 | 'view movies' => 2000, |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $re = new ReleaseExtra; |
35 | 35 | $data = Release::getByGuid($guid); |
36 | 36 | $releaseRegex = ''; |
37 | - if (! empty($data)) { |
|
37 | + if (!empty($data)) { |
|
38 | 38 | $releaseRegex = ReleaseRegex::query()->where('releases_id', '=', $data['id'])->first(); |
39 | 39 | } |
40 | 40 | |
41 | - if (! $data) { |
|
41 | + if (!$data) { |
|
42 | 42 | return redirect()->back(); |
43 | 43 | } |
44 | 44 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($data['imdbid'] !== '' && $data['imdbid'] !== 0000000) { |
65 | 65 | $movie = new Movie(['Settings' => $this->settings]); |
66 | 66 | $mov = $movie->getMovieInfo($data['imdbid']); |
67 | - if (! empty($mov['title'])) { |
|
67 | + if (!empty($mov['title'])) { |
|
68 | 68 | $mov['title'] = str_replace(['/', '\\'], '', $mov['title']); |
69 | 69 | $mov['actors'] = makeFieldLinks($mov, 'actors', 'movies'); |
70 | 70 | $mov['genre'] = makeFieldLinks($mov, 'genre', 'movies'); |