• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visavi / rotor / 28340133337

28 Jun 2026 11:47PM UTC coverage: 16.561% (+0.09%) from 16.474%
28340133337

push

github

visavi
Ядро и модули переведены на datetime, удалена константа SITETIME

18 of 95 new or added lines in 31 files covered. (18.95%)

7 existing lines in 6 files now uncovered.

989 of 5972 relevant lines covered (16.56%)

2.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/Http/Controllers/User/BanController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Http\Controllers\User;
6

7
use App\Classes\Validator;
8
use App\Http\Controllers\Controller;
9
use App\Models\Banhist;
10
use App\Models\User;
11
use Illuminate\Http\RedirectResponse;
12
use Illuminate\Http\Request;
13
use Illuminate\View\View;
14

15
class BanController extends Controller
16
{
17
    /**
18
     * User Ban
19
     */
20
    public function ban(Request $request, Validator $validator): View|RedirectResponse
×
21
    {
22
        if (! $user = getUser()) {
×
23
            abort(403, __('main.not_authorized'));
×
24
        }
25

26
        if ($user->level !== User::BANNED) {
×
27
            abort(200, __('users.not_banned'));
×
28
        }
29

NEW
30
        if (! $user->timeban || $user->timeban->lte(now())) {
×
31
            $user->update([
×
32
                'level'   => User::USER,
×
NEW
33
                'timeban' => null,
×
34
            ]);
×
35

36
            setFlash('success', __('users.ban_expired'));
×
37

38
            return redirect('/');
×
39
        }
40

41
        $banhist = Banhist::query()
×
42
            ->where('user_id', $user->id)
×
43
            ->whereIn('type', ['ban', 'change'])
×
44
            ->orderByDesc('created_at')
×
45
            ->first();
×
46

47
        if ($banhist && $request->isMethod('post')) {
×
48
            $msg = $request->input('msg');
×
49

50
            $admins = User::query()->whereIn('level', [User::BOSS, User::ADMIN])->get();
×
51

52
            $validator
×
53
                ->true(setting('addbansend'), __('users.explain_forbidden'))
×
54
                ->false($banhist->explain, __('users.explain_repeat'))
×
55
                ->true($admins->isNotEmpty(), __('users.admins_not_found'))
×
56
                ->length($msg, 5, 1000, ['text' => __('validator.text')]);
×
57

58
            if ($validator->isValid()) {
×
59
                $text = textNotice('explain', ['message' => antimat($msg)]);
×
60

61
                foreach ($admins as $admin) {
×
62
                    $admin->sendMessage($user, $text, false);
×
63
                }
64

65
                $banhist->update([
×
66
                    'explain' => 1,
×
67
                ]);
×
68

69
                setFlash('success', __('users.explain_sent_success'));
×
70

71
                return redirect('ban');
×
72
            }
73

74
            setInput($request->all());
×
75
            setFlash('danger', $validator->getErrors());
×
76
        }
77

78
        return view('users/bans', compact('user', 'banhist'));
×
79
    }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc