@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function validate(string $attribute, mixed $value, Closure $fail): void |
| 89 | 89 | { |
| 90 | - if (empty($value) || ! is_string($value)) { |
|
| 90 | + if (empty($value) || !is_string($value)) { |
|
| 91 | 91 | $fail('The :attribute must be a valid email address.'); |
| 92 | 92 | return; |
| 93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Check 1: Use the disposable email package |
| 118 | - if (! DisposableDomains::isNotDisposable($value)) { |
|
| 118 | + if (!DisposableDomains::isNotDisposable($value)) { |
|
| 119 | 119 | Log::warning('Disposable email attempt blocked (package detection)', [ |
| 120 | 120 | 'email' => $value, |
| 121 | 121 | 'domain' => $domain, |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Check 4: Validate domain has valid DNS records (MX or A record) |
| 151 | - if (! $this->validateDnsRecords($domain)) { |
|
| 151 | + if (!$this->validateDnsRecords($domain)) { |
|
| 152 | 152 | Log::warning('Email domain has no valid DNS records', [ |
| 153 | 153 | 'email' => $value, |
| 154 | 154 | 'domain' => $domain, |
@@ -187,12 +187,12 @@ |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Get all promotions with their statistics |
| 190 | - $promotions = RolePromotion::withCount(['statistics' => function ($query) use ($startDate, $endDate) { |
|
| 190 | + $promotions = RolePromotion::withCount(['statistics' => function($query) use ($startDate, $endDate) { |
|
| 191 | 191 | if ($startDate) { |
| 192 | 192 | $query->whereBetween('applied_at', [$startDate, $endDate]); |
| 193 | 193 | } |
| 194 | 194 | }]) |
| 195 | - ->with(['statistics' => function ($query) use ($startDate, $endDate) { |
|
| 195 | + ->with(['statistics' => function($query) use ($startDate, $endDate) { |
|
| 196 | 196 | if ($startDate) { |
| 197 | 197 | $query->whereBetween('applied_at', [$startDate, $endDate]); |
| 198 | 198 | } |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | return [ |
| 125 | 125 | 'total_promotions_received' => $stats->count(), |
| 126 | 126 | 'total_days_added' => $stats->sum('days_added'), |
| 127 | - 'promotions' => $stats->groupBy('role_promotion_id')->map(function ($group) { |
|
| 127 | + 'promotions' => $stats->groupBy('role_promotion_id')->map(function($group) { |
|
| 128 | 128 | return [ |
| 129 | 129 | 'promotion_id' => $group->first()->role_promotion_id, |
| 130 | 130 | 'promotion_name' => $group->first()->promotion?->name, |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $now = Carbon::now(); |
| 71 | 71 | return $query->where('is_active', true) |
| 72 | - ->where(function ($q) use ($now) { |
|
| 72 | + ->where(function($q) use ($now) { |
|
| 73 | 73 | $q->whereNull('end_date') |
| 74 | 74 | ->orWhere('end_date', '>=', $now); |
| 75 | 75 | }) |
| 76 | - ->where(function ($q) use ($now) { |
|
| 76 | + ->where(function($q) use ($now) { |
|
| 77 | 77 | $q->whereNull('start_date') |
| 78 | 78 | ->orWhere('start_date', '<=', $now); |
| 79 | 79 | }); |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | $query = static::where('is_active', true); |
| 119 | 119 | |
| 120 | 120 | $now = Carbon::now(); |
| 121 | - $query->where(function ($q) use ($now) { |
|
| 121 | + $query->where(function($q) use ($now) { |
|
| 122 | 122 | $q->whereNull('start_date') |
| 123 | 123 | ->orWhere('start_date', '<=', $now); |
| 124 | 124 | }); |
| 125 | 125 | |
| 126 | - $query->where(function ($q) use ($now) { |
|
| 126 | + $query->where(function($q) use ($now) { |
|
| 127 | 127 | $q->whereNull('end_date') |
| 128 | 128 | ->orWhere('end_date', '>=', $now); |
| 129 | 129 | }); |
| 130 | 130 | |
| 131 | 131 | if ($roleId !== null) { |
| 132 | - $query->where(function ($q) use ($roleId) { |
|
| 132 | + $query->where(function($q) use ($roleId) { |
|
| 133 | 133 | // If applicable_roles is empty, applies to all custom roles |
| 134 | 134 | $q->whereJsonLength('applicable_roles', 0) |
| 135 | 135 | ->orWhereJsonContains('applicable_roles', $roleId); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | ->with('role') |
| 210 | 210 | ->get() |
| 211 | 211 | ->groupBy('role_id') |
| 212 | - ->map(function ($stats, $roleId) { |
|
| 212 | + ->map(function($stats, $roleId) { |
|
| 213 | 213 | return [ |
| 214 | 214 | 'role_id' => $roleId, |
| 215 | 215 | 'role_name' => $stats->first()->role?->name, |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $res = self::query()->withTrashed()->where('email', '<>', '[email protected]'); |
| 271 | 271 | |
| 272 | - if (! empty($role)) { |
|
| 272 | + if (!empty($role)) { |
|
| 273 | 273 | $res->where('roles_id', $role); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
| 319 | 319 | ]; |
| 320 | 320 | |
| 321 | - if (! empty($email)) { |
|
| 321 | + if (!empty($email)) { |
|
| 322 | 322 | $email = trim($email); |
| 323 | 323 | $sql += ['email' => $email]; |
| 324 | 324 | } |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | return self::fromQuery( |
| 428 | 428 | sprintf( |
| 429 | 429 | $query, |
| 430 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 431 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 432 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 433 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 434 | - ! empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 435 | - ! empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 430 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 431 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 432 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 433 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 434 | + !empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 435 | + !empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 436 | 436 | $order[0], |
| 437 | 437 | $order[1], |
| 438 | 438 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | public static function isValidUrl($url): bool |
| 546 | 546 | { |
| 547 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 547 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
| 582 | 582 | $invitedBy = 0; |
| 583 | - if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 583 | + if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 584 | 584 | if ($inviteCode === '') { |
| 585 | 585 | return self::ERR_SIGNUP_BADINVITECODE; |
| 586 | 586 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | public static function checkAndUseInvite(string $inviteCode): int |
| 601 | 601 | { |
| 602 | 602 | $invite = Invitation::findValidByToken($inviteCode); |
| 603 | - if (! $invite) { |
|
| 603 | + if (!$invite) { |
|
| 604 | 604 | return -1; |
| 605 | 605 | } |
| 606 | 606 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
| 617 | 617 | { |
| 618 | 618 | $password = self::hashPassword($password); |
| 619 | - if (! $password) { |
|
| 619 | + if (!$password) { |
|
| 620 | 620 | return false; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -658,9 +658,9 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
| 660 | 660 | |
| 661 | - if (! empty($allowed)) { |
|
| 661 | + if (!empty($allowed)) { |
|
| 662 | 662 | foreach ($cats as $cat) { |
| 663 | - if (! \in_array($cat, $allowed, false)) { |
|
| 663 | + if (!\in_array($cat, $allowed, false)) { |
|
| 664 | 664 | $ret[] = match ($cat) { |
| 665 | 665 | 'view console' => 1000, |
| 666 | 666 | 'view movies' => 2000, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // Add country data to each user based on their host IP |
| 61 | 61 | foreach ($results as $user) { |
| 62 | 62 | $position = null; |
| 63 | - if (! empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 63 | + if (!empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 64 | 64 | $position = Location::get($user->host); |
| 65 | 65 | } |
| 66 | 66 | $user->country_name = $position ? $position->countryName : null; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | // This must happen BEFORE role change so the new expiry applies to the old role |
| 183 | 183 | if ($request->has('rolechangedate')) { |
| 184 | 184 | $roleChangeDate = $request->input('rolechangedate'); |
| 185 | - if (! empty($roleChangeDate)) { |
|
| 185 | + if (!empty($roleChangeDate)) { |
|
| 186 | 186 | User::updateUserRoleChangeDate($editedUser->id, $roleChangeDate); |
| 187 | 187 | $editedUser->refresh(); |
| 188 | 188 | } else { |
@@ -257,13 +257,13 @@ |
||
| 257 | 257 | UserRoleHistory::recordRoleChange( |
| 258 | 258 | userId: $user->id, |
| 259 | 259 | oldRoleId: $oldRole ? $oldRole->id : null, |
| 260 | - newRoleId: $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | - oldExpiryDate: null, |
|
| 262 | - newExpiryDate: null, |
|
| 263 | - effectiveDate: $now, |
|
| 264 | - isStacked: true, |
|
| 265 | - changeReason: 'manual_activation', |
|
| 266 | - changedBy: null |
|
| 260 | + newRoleId : $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | + oldExpiryDate : null, |
|
| 262 | + newExpiryDate : null, |
|
| 263 | + effectiveDate : $now, |
|
| 264 | + isStacked : true, |
|
| 265 | + changeReason : 'manual_activation', |
|
| 266 | + changedBy : null |
|
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | 269 | $this->info(sprintf( |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | $sessionManager = new TmuxSessionManager($sessionName); |
| 36 | 36 | |
| 37 | - if (! $sessionManager->sessionExists()) { |
|
| 37 | + if (!$sessionManager->sessionExists()) { |
|
| 38 | 38 | $this->error("❌ Session '{$sessionName}' does not exist"); |
| 39 | 39 | $this->info(" |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $this->info(' |