Passed
Push — master ( 61beee...1576de )
by Darko
10:00
created
app/Http/Controllers/Admin/DeletedUsersController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
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
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
300 300
         ];
301 301
 
302
-        if (! empty($email)) {
302
+        if (!empty($email)) {
303 303
             $email = trim($email);
304 304
             $sql += ['email' => $email];
305 305
         }
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
     {
349 349
         $user = self::find($uid);
350 350
         $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString();
351
-        if (! empty($date)) {
351
+        if (!empty($date)) {
352 352
             $user->update(['rolechangedate' => $date]);
353 353
         }
354
-        if (empty($date) && ! empty($addYear)) {
354
+        if (empty($date) && !empty($addYear)) {
355 355
             $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]);
356 356
         }
357 357
     }
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
         return self::fromQuery(
409 409
             sprintf(
410 410
                 $query,
411
-                ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
412
-                ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
413
-                ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
414
-                (! empty($role) ? ('AND users.roles_id = '.$role) : ''),
411
+                !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
412
+                !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
413
+                !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
414
+                (!empty($role) ? ('AND users.roles_id = '.$role) : ''),
415 415
                 $order[0],
416 416
                 $order[1],
417 417
                 ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start))
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
     public static function isValidUrl($url): bool
525 525
     {
526
-        return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
526
+        return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
527 527
     }
528 528
 
529 529
     /**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
         // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
561 561
         $invitedBy = 0;
562
-        if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
562
+        if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
563 563
             if ($inviteCode === '') {
564 564
                 return self::ERR_SIGNUP_BADINVITECODE;
565 565
             }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
     public static function checkAndUseInvite(string $inviteCode): int
580 580
     {
581 581
         $invite = Invitation::findValidByToken($inviteCode);
582
-        if (! $invite) {
582
+        if (!$invite) {
583 583
             return -1;
584 584
         }
585 585
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
596 596
     {
597 597
         $password = self::hashPassword($password);
598
-        if (! $password) {
598
+        if (!$password) {
599 599
             return false;
600 600
         }
601 601
 
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 
638 638
         $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other'];
639 639
 
640
-        if (! empty($allowed)) {
640
+        if (!empty($allowed)) {
641 641
             foreach ($cats as $cat) {
642
-                if (! \in_array($cat, $allowed, false)) {
642
+                if (!\in_array($cat, $allowed, false)) {
643 643
                     $ret[] = match ($cat) {
644 644
                         'view console' => 1000,
645 645
                         'view movies' => 2000,
Please login to merge, or discard this patch.