@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $hourKey = $metric->recorded_at->format('Y-m-d H:00'); |
| 51 | 51 | $hourLabel = $metric->recorded_at->format('H:i'); |
| 52 | 52 | |
| 53 | - if (! isset($hourlyData[$hourKey])) { |
|
| 53 | + if (!isset($hourlyData[$hourKey])) { |
|
| 54 | 54 | $hourlyData[$hourKey] = [ |
| 55 | 55 | 'time' => $hourLabel, |
| 56 | 56 | 'values' => [], |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $dayKey = $metric->recorded_at->format('Y-m-d'); |
| 91 | 91 | $dayLabel = $metric->recorded_at->format('M d'); |
| 92 | 92 | |
| 93 | - if (! isset($dailyData[$dayKey])) { |
|
| 93 | + if (!isset($dailyData[$dayKey])) { |
|
| 94 | 94 | $dailyData[$dayKey] = [ |
| 95 | 95 | 'time' => $dayLabel, |
| 96 | 96 | 'values' => [], |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if (! TurnstileService::verify($value)) { |
|
| 22 | + if (!TurnstileService::verify($value)) { |
|
| 23 | 23 | $fail('The captcha verification failed. Please try again.'); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | ->limit(10) |
| 57 | 57 | ->get(); |
| 58 | 58 | |
| 59 | - return $activities->map(function ($activity) { |
|
| 59 | + return $activities->map(function($activity) { |
|
| 60 | 60 | return (object) [ |
| 61 | 61 | 'type' => $activity->activity_type, |
| 62 | 62 | 'message' => $activity->description, |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | return response()->json([ |
| 80 | 80 | 'success' => true, |
| 81 | - 'activities' => array_map(function ($activity) { |
|
| 81 | + 'activities' => array_map(function($activity) { |
|
| 82 | 82 | return [ |
| 83 | 83 | 'type' => $activity->type, |
| 84 | 84 | 'message' => $activity->message, |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | // Get number of physical cores |
| 267 | 267 | preg_match_all('/^cpu cores\s*:\s*(\d+)/m', $cpuinfo, $coresMatches); |
| 268 | - if (! empty($coresMatches[1])) { |
|
| 268 | + if (!empty($coresMatches[1])) { |
|
| 269 | 269 | $info['cores'] = (int) $coresMatches[1][0]; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -275,14 +275,14 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Get CPU model |
| 277 | 277 | preg_match('/^model name\s*:\s*(.+)$/m', $cpuinfo, $modelMatches); |
| 278 | - if (! empty($modelMatches[1])) { |
|
| 278 | + if (!empty($modelMatches[1])) { |
|
| 279 | 279 | $info['model'] = trim($modelMatches[1]); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // If cores is 0, try to get from physical id count |
| 283 | 283 | if ($info['cores'] === 0) { |
| 284 | 284 | preg_match_all('/^physical id\s*:\s*(\d+)/m', $cpuinfo, $physicalMatches); |
| 285 | - $uniquePhysical = ! empty($physicalMatches[1]) ? count(array_unique($physicalMatches[1])) : 1; |
|
| 285 | + $uniquePhysical = !empty($physicalMatches[1]) ? count(array_unique($physicalMatches[1])) : 1; |
|
| 286 | 286 | $info['cores'] = (int) ($info['threads'] / $uniquePhysical); |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | */ |
| 115 | 115 | private function getRoleName(?int $roleId): string |
| 116 | 116 | { |
| 117 | - if (! $roleId) { |
|
| 117 | + if (!$roleId) { |
|
| 118 | 118 | return 'None'; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $type = $this->option('type'); |
| 38 | 38 | $force = $this->option('force'); |
| 39 | 39 | |
| 40 | - if (! in_array($type, ['daily', 'hourly'])) { |
|
| 40 | + if (!in_array($type, ['daily', 'hourly'])) { |
|
| 41 | 41 | $this->error("Invalid type '{$type}'. Must be 'daily' or 'hourly'."); |
| 42 | 42 | |
| 43 | 43 | return Command::FAILURE; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $date = Carbon::now()->subDays($i)->format('Y-m-d'); |
| 69 | 69 | |
| 70 | 70 | // Check if stats already exist for this date |
| 71 | - if (! $force && UserActivityStat::where('stat_date', $date)->exists()) { |
|
| 71 | + if (!$force && UserActivityStat::where('stat_date', $date)->exists()) { |
|
| 72 | 72 | $statsSkipped++; |
| 73 | 73 | $progressBar->advance(); |
| 74 | 74 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $hour = Carbon::now()->subHours($i)->startOfHour()->format('Y-m-d H:00:00'); |
| 129 | 129 | |
| 130 | 130 | // Check if stats already exist for this hour |
| 131 | - if (! $force && DB::table('user_activity_stats_hourly')->where('stat_hour', $hour)->exists()) { |
|
| 131 | + if (!$force && DB::table('user_activity_stats_hourly')->where('stat_hour', $hour)->exists()) { |
|
| 132 | 132 | $statsSkipped++; |
| 133 | 133 | $progressBar->advance(); |
| 134 | 134 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->when($email !== '', fn ($q) => $q->where('users.email', 'like', "%$email%")) |
| 35 | 35 | ->when($host !== '', fn ($q) => $q->where('users.host', 'like', "%$host%")) |
| 36 | 36 | // Created date filters |
| 37 | - ->when($createdFrom !== '' || $createdTo !== '', function ($q) use ($createdFrom, $createdTo) { |
|
| 37 | + ->when($createdFrom !== '' || $createdTo !== '', function($q) use ($createdFrom, $createdTo) { |
|
| 38 | 38 | try { |
| 39 | 39 | if ($createdFrom !== '' && $createdTo !== '') { |
| 40 | 40 | $from = Carbon::createFromFormat('Y-m-d', $createdFrom)->startOfDay(); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | }) |
| 54 | 54 | // Deleted date filters |
| 55 | - ->when($deletedFrom !== '' || $deletedTo !== '', function ($q) use ($deletedFrom, $deletedTo) { |
|
| 55 | + ->when($deletedFrom !== '' || $deletedTo !== '', function($q) use ($deletedFrom, $deletedTo) { |
|
| 56 | 56 | try { |
| 57 | 57 | if ($deletedFrom !== '' && $deletedTo !== '') { |
| 58 | 58 | $from = Carbon::createFromFormat('Y-m-d', $deletedFrom)->startOfDay(); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $userIds = $request->input('user_ids', []); |
| 110 | 110 | |
| 111 | 111 | // Better validation with specific error messages |
| 112 | - if (empty($action) || ! in_array($action, ['restore', 'delete'], true)) { |
|
| 112 | + if (empty($action) || !in_array($action, ['restore', 'delete'], true)) { |
|
| 113 | 113 | return redirect()->route('admin.deleted.users.index')->with('error', 'Please select a valid action.'); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if (! is_array($userIds)) { |
|
| 116 | + if (!is_array($userIds)) { |
|
| 117 | 117 | return redirect()->route('admin.deleted.users.index')->with('error', 'Invalid user selection format.'); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $res = self::query()->withTrashed()->where('email', '<>', '[email protected]'); |
| 260 | 260 | |
| 261 | - if (! empty($role)) { |
|
| 261 | + if (!empty($role)) { |
|
| 262 | 262 | $res->where('roles_id', $role); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
| 308 | 308 | ]; |
| 309 | 309 | |
| 310 | - if (! empty($email)) { |
|
| 310 | + if (!empty($email)) { |
|
| 311 | 311 | $email = trim($email); |
| 312 | 312 | $sql += ['email' => $email]; |
| 313 | 313 | } |
@@ -356,10 +356,10 @@ discard block |
||
| 356 | 356 | { |
| 357 | 357 | $user = self::find($uid); |
| 358 | 358 | $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString(); |
| 359 | - if (! empty($date)) { |
|
| 359 | + if (!empty($date)) { |
|
| 360 | 360 | $user->update(['rolechangedate' => $date]); |
| 361 | 361 | } |
| 362 | - if (empty($date) && ! empty($addYear)) { |
|
| 362 | + if (empty($date) && !empty($addYear)) { |
|
| 363 | 363 | $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]); |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | return self::fromQuery( |
| 417 | 417 | sprintf( |
| 418 | 418 | $query, |
| 419 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 420 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 421 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 422 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 423 | - ! empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 424 | - ! empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 419 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 420 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 421 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 422 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 423 | + !empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 424 | + !empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 425 | 425 | $order[0], |
| 426 | 426 | $order[1], |
| 427 | 427 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | public static function isValidUrl($url): bool |
| 535 | 535 | { |
| 536 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 536 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | /** |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
| 571 | 571 | $invitedBy = 0; |
| 572 | - if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 572 | + if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 573 | 573 | if ($inviteCode === '') { |
| 574 | 574 | return self::ERR_SIGNUP_BADINVITECODE; |
| 575 | 575 | } |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | public static function checkAndUseInvite(string $inviteCode): int |
| 590 | 590 | { |
| 591 | 591 | $invite = Invitation::findValidByToken($inviteCode); |
| 592 | - if (! $invite) { |
|
| 592 | + if (!$invite) { |
|
| 593 | 593 | return -1; |
| 594 | 594 | } |
| 595 | 595 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
| 606 | 606 | { |
| 607 | 607 | $password = self::hashPassword($password); |
| 608 | - if (! $password) { |
|
| 608 | + if (!$password) { |
|
| 609 | 609 | return false; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -647,9 +647,9 @@ discard block |
||
| 647 | 647 | |
| 648 | 648 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
| 649 | 649 | |
| 650 | - if (! empty($allowed)) { |
|
| 650 | + if (!empty($allowed)) { |
|
| 651 | 651 | foreach ($cats as $cat) { |
| 652 | - if (! \in_array($cat, $allowed, false)) { |
|
| 652 | + if (!\in_array($cat, $allowed, false)) { |
|
| 653 | 653 | $ret[] = match ($cat) { |
| 654 | 654 | 'view console' => 1000, |
| 655 | 655 | 'view movies' => 2000, |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | return $user; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 33 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 34 | 34 | |
| 35 | 35 | $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); |
| 36 | 36 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1; |
| 56 | 56 | $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); |
| 57 | 57 | $relData = $rss->getShowsRss($userNum, $user['user_id'], User::getCategoryExclusionById($user['user_id']), $userAirDate); |
| 58 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 58 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 59 | 59 | |
| 60 | 60 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss'); |
| 61 | 61 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } elseif ($request->has('anidb')) { |
| 83 | 83 | $userAnidb = ((int) $request->input('anidb') === 0 ? -1 : $request->input('anidb') + 0); |
| 84 | 84 | } |
| 85 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 85 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 86 | 86 | $relData = $rss->getRss(Arr::wrap(0), $userShow, $userAnidb, $user['user_id'], $userAirDate, $userLimit, $userNum); |
| 87 | 87 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss'); |
| 88 | 88 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | if (is_object($user)) { |
| 128 | 128 | return $user; |
| 129 | 129 | } |
| 130 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 130 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 131 | 131 | $userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1; |
| 132 | 132 | $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); |
| 133 | 133 | $userLimit = $request->has('limit') && is_numeric($request->input('limit')) ? $request->input('limit') : 100; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } elseif ($request->has('anidb')) { |
| 168 | 168 | $userAnidb = ((int) $request->input('anidb') === 0 ? -1 : $request->input('anidb') + 0); |
| 169 | 169 | } |
| 170 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 170 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 171 | 171 | $relData = $rss->getRss($categoryId, $userShow, $userAnidb, $user['user_id'], $userAirDate, $userLimit, $userNum); |
| 172 | 172 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss'); |
| 173 | 173 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | if (is_object($user)) { |
| 184 | 184 | return $user; |
| 185 | 185 | } |
| 186 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 186 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 187 | 187 | |
| 188 | 188 | $relData = $rss->getTrendingMoviesRss(); |
| 189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if (is_object($user)) { |
| 202 | 202 | return $user; |
| 203 | 203 | } |
| 204 | - $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); |
|
| 204 | + $outputXML = (!($request->has('o') && $request->input('o') === 'json')); |
|
| 205 | 205 | |
| 206 | 206 | $relData = $rss->getTrendingShowsRss(); |
| 207 | 207 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | Category::TV_ROOT, |
| 107 | 107 | Category::TV_OTHER, |
| 108 | 108 | $this->releases->showPasswords(), |
| 109 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 109 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | 112 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | Category::MOVIE_ROOT, |
| 135 | 135 | Category::MOVIE_OTHER, |
| 136 | 136 | $this->releases->showPasswords(), |
| 137 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 137 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $cacheKey = 'rss_trending_movies_48h'; |
| 160 | 160 | |
| 161 | - return Cache::remember($cacheKey, 3600, function () { |
|
| 161 | + return Cache::remember($cacheKey, 3600, function() { |
|
| 162 | 162 | $fortyEightHoursAgo = \Illuminate\Support\Carbon::now()->subHours(48); |
| 163 | 163 | |
| 164 | 164 | // First get the top 15 movies by download count |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | $cacheKey = 'rss_trending_shows_48h'; |
| 220 | 220 | |
| 221 | - return Cache::remember($cacheKey, 3600, function () { |
|
| 221 | + return Cache::remember($cacheKey, 3600, function() { |
|
| 222 | 222 | $fortyEightHoursAgo = \Illuminate\Support\Carbon::now()->subHours(48); |
| 223 | 223 | |
| 224 | 224 | // First get the top 15 TV shows by download count |