@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | use App\Http\Controllers\RssController; |
13 | 13 | |
14 | -Route::middleware(['auth:api', 'auth:rss'])->group(function () { |
|
14 | +Route::middleware(['auth:api', 'auth:rss'])->group(function() { |
|
15 | 15 | Route::get('mymovies', [RssController::class, 'myMoviesRss']); |
16 | 16 | Route::post('mymovies', [RssController::class, 'myMoviesRss']); |
17 | 17 | Route::get('myshows', [RssController::class, 'myShowsRss']); |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | use App\Http\Controllers\Api\ApiInformController; |
16 | 16 | use App\Http\Controllers\Api\ApiV2Controller; |
17 | 17 | |
18 | -Route::prefix('v1')->group(function () { |
|
18 | +Route::prefix('v1')->group(function() { |
|
19 | 19 | Route::get('api', [ApiController::class, 'api']); |
20 | 20 | Route::post('api', [ApiController::class, 'api']); |
21 | 21 | }); |
22 | 22 | |
23 | -Route::prefix('v2')->group(function () { |
|
23 | +Route::prefix('v2')->group(function() { |
|
24 | 24 | Route::get('capabilities', [ApiV2Controller::class, 'capabilities']); |
25 | 25 | Route::post('capabilities', [ApiV2Controller::class, 'capabilities']); |
26 | 26 | }); |
27 | 27 | |
28 | -Route::prefix('v2')->middleware('auth:api', 'throttle:rate_limit,1')->group(function () { |
|
28 | +Route::prefix('v2')->middleware('auth:api', 'throttle:rate_limit,1')->group(function() { |
|
29 | 29 | Route::get('movies', [ApiV2Controller::class, 'movie']); |
30 | 30 | Route::post('movies', [ApiV2Controller::class, 'movie']); |
31 | 31 | Route::get('search', [ApiV2Controller::class, 'apiSearch']); |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | Route::post('details', [ApiV2Controller::class, 'details']); |
39 | 39 | }); |
40 | 40 | |
41 | -Route::prefix('inform')->middleware('auth:api')->group(function () { |
|
41 | +Route::prefix('inform')->middleware('auth:api')->group(function() { |
|
42 | 42 | Route::get('release', [ApiInformController::class, 'release']); |
43 | 43 | Route::post('release', [ApiInformController::class, 'release']); |
44 | 44 | }); |
45 | 45 | |
46 | -Route::fallback(function () { |
|
46 | +Route::fallback(function() { |
|
47 | 47 | return response()->json(['message' => 'Not Found!'], 404); |
48 | 48 | }); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | [ |
50 | 50 | 'users_id' => $uid, |
51 | 51 | 'imdbid' => $imdbid, |
52 | - 'categories' => ! empty($catID) ? implode('|', $catID) : 'NULL', |
|
52 | + 'categories' => !empty($catID) ? implode('|', $catID) : 'NULL', |
|
53 | 53 | 'created_at' => now(), |
54 | 54 | ] |
55 | 55 | ); |
@@ -91,6 +91,6 @@ discard block |
||
91 | 91 | { |
92 | 92 | self::query() |
93 | 93 | ->where(['users_id' => $uid, 'imdbid' => $imdbid]) |
94 | - ->update(['categories' => ! empty($catID) ? implode('|', $catID) : 'NULL']); |
|
94 | + ->update(['categories' => !empty($catID) ? implode('|', $catID) : 'NULL']); |
|
95 | 95 | } |
96 | 96 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | public static function updateRelease($id, $name, $searchName, $fromName, $categoryId, $parts, $grabs, $size, $postedDate, $addedDate, $videoId, $episodeId, $imDbId, $aniDbId): void |
281 | 281 | { |
282 | 282 | $movieInfoId = null; |
283 | - if (! empty($imDbId)) { |
|
283 | + if (!empty($imDbId)) { |
|
284 | 284 | $movieInfoId = MovieInfo::whereImdbid($imDbId)->first(['id']); |
285 | 285 | } |
286 | 286 | self::whereId($id)->update( |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | |
532 | 532 | preg_match('/(^\w+[-_. ].+?\.(\d+p)).+/i', $rel['searchname'], $similar); |
533 | 533 | |
534 | - if (! empty($similar)) { |
|
534 | + if (!empty($similar)) { |
|
535 | 535 | if (config('nntmux.elasticsearch_enabled') === true) { |
536 | 536 | $searchResult = (new ElasticSearchSiteSearch())->indexSearch($similar[1], 10); |
537 | 537 | } else { |
538 | 538 | $searchResult = (new ManticoreSearch())->searchIndexes('releases_rt', $similar[1]); |
539 | - if (! empty($searchResult)) { |
|
539 | + if (!empty($searchResult)) { |
|
540 | 540 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
541 | 541 | } |
542 | 542 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function delApiRequests($userID): void |
61 | 61 | { |
62 | - DB::transaction(function () use ($userID) { |
|
62 | + DB::transaction(function() use ($userID) { |
|
63 | 63 | self::query()->where('users_id', $userID)->delete(); |
64 | 64 | }, 3); |
65 | 65 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | self::clearApiRequests($userID); |
78 | 78 | $requests = self::query()->where('users_id', $userID)->count('id'); |
79 | 79 | |
80 | - return ! $requests ? 0 : $requests; |
|
80 | + return !$requests ? 0 : $requests; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public static function clearApiRequests($userID): void |
106 | 106 | { |
107 | - DB::transaction(function () use ($userID) { |
|
107 | + DB::transaction(function() use ($userID) { |
|
108 | 108 | if ($userID === false) { |
109 | 109 | self::query()->where('timestamp', '<', now()->subDay())->delete(); |
110 | 110 | } else { |
@@ -68,7 +68,7 @@ |
||
68 | 68 | public static function getFailedCount($relId) |
69 | 69 | { |
70 | 70 | $result = self::query()->where('release_id', $relId)->value('failed'); |
71 | - if (! empty($result)) { |
|
71 | + if (!empty($result)) { |
|
72 | 72 | return $result; |
73 | 73 | } |
74 | 74 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | ->select(['videos.*', 'tve.firstaired as prevdate', 'tve.title as previnfo', 'tvi.publisher', 'us.id as userseriesid']) |
137 | 137 | ->join('tv_info as tvi', 'videos.id', '=', 'tvi.videos_id') |
138 | 138 | ->join('tv_episodes as tve', 'videos.id', '=', 'tve.videos_id') |
139 | - ->leftJoin('user_series as us', function ($join) use ($uid) { |
|
139 | + ->leftJoin('user_series as us', function($join) use ($uid) { |
|
140 | 140 | $join->on('videos.id', '=', 'us.videos_id')->where('us.users_id', '=', $uid); |
141 | 141 | }) |
142 | 142 | ->whereBetween('r.categories_id', [Category::TV_ROOT, Category::TV_OTHER]) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | [ |
60 | 60 | 'users_id' => $userId, |
61 | 61 | 'videos_id' => $videoId, |
62 | - 'categories' => ! empty($catID) ? implode('|', $catID) : 'NULL', |
|
62 | + 'categories' => !empty($catID) ? implode('|', $catID) : 'NULL', |
|
63 | 63 | 'created_at' => now(), |
64 | 64 | 'updated_at' => now(), |
65 | 65 | ] |
@@ -127,6 +127,6 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public static function updateShow($users_id, $videos_id, array $catID = []): void |
129 | 129 | { |
130 | - self::query()->where(compact('users_id', 'videos_id'))->update(['categories' => ! empty($catID) ? implode('|', $catID) : 'NULL']); |
|
130 | + self::query()->where(compact('users_id', 'videos_id'))->update(['categories' => !empty($catID) ? implode('|', $catID) : 'NULL']); |
|
131 | 131 | } |
132 | 132 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | $res = self::query()->where('email', '<>', '[email protected]'); |
252 | 252 | |
253 | - if (! empty($role)) { |
|
253 | + if (!empty($role)) { |
|
254 | 254 | $res->where('roles_id', $role); |
255 | 255 | } |
256 | 256 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
292 | 292 | ]; |
293 | 293 | |
294 | - if (! empty($email)) { |
|
294 | + if (!empty($email)) { |
|
295 | 295 | $email = trim($email); |
296 | 296 | $sql += ['email' => $email]; |
297 | 297 | } |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | { |
337 | 337 | $user = self::find($uid); |
338 | 338 | $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString(); |
339 | - if (! empty($date)) { |
|
339 | + if (!empty($date)) { |
|
340 | 340 | $user->update(['rolechangedate' => $date]); |
341 | 341 | } |
342 | - if (empty($date) && ! empty($addYear)) { |
|
342 | + if (empty($date) && !empty($addYear)) { |
|
343 | 343 | $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]); |
344 | 344 | } |
345 | 345 | } |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return self::fromQuery( |
397 | 397 | sprintf( |
398 | 398 | $query, |
399 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
400 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
401 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
402 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
399 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
400 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
401 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
402 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
403 | 403 | $order[0], |
404 | 404 | $order[1], |
405 | 405 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | public static function isValidUrl($url): bool |
513 | 513 | { |
514 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
514 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
549 | 549 | $invitedBy = 0; |
550 | - if (! $forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
550 | + if (!$forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
551 | 551 | if ($inviteCode === '') { |
552 | 552 | return self::ERR_SIGNUP_BADINVITECODE; |
553 | 553 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | public static function checkAndUseInvite(string $inviteCode): int |
568 | 568 | { |
569 | 569 | $invite = Invitation::getInvite($inviteCode); |
570 | - if (! $invite) { |
|
570 | + if (!$invite) { |
|
571 | 571 | return -1; |
572 | 572 | } |
573 | 573 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | public static function add(string $userName, string $password, string $email, int $role, string|null $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
584 | 584 | { |
585 | 585 | $password = self::hashPassword($password); |
586 | - if (! $password) { |
|
586 | + if (!$password) { |
|
587 | 587 | return false; |
588 | 588 | } |
589 | 589 | |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | |
626 | 626 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
627 | 627 | |
628 | - if (! empty($allowed)) { |
|
628 | + if (!empty($allowed)) { |
|
629 | 629 | foreach ($cats as $cat) { |
630 | - if (! \in_array($cat, $allowed, false)) { |
|
630 | + if (!\in_array($cat, $allowed, false)) { |
|
631 | 631 | switch ($cat) { |
632 | 632 | case 'view console': |
633 | 633 | $ret[] = 1000; |