ZsgsDesign /
NOJ
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Admin\Controllers; |
||||||
| 4 | |||||||
| 5 | use App\Models\Eloquent\Judger; |
||||||
| 6 | use App\Models\JudgerModel; |
||||||
| 7 | use App\Models\Eloquent\OJ; |
||||||
| 8 | use Encore\Admin\Controllers\AdminController; |
||||||
| 9 | use Encore\Admin\Controllers\HasResourceActions; |
||||||
| 10 | use Encore\Admin\Form; |
||||||
| 11 | use Encore\Admin\Grid; |
||||||
| 12 | use Encore\Admin\Layout\Content; |
||||||
| 13 | use Encore\Admin\Show; |
||||||
| 14 | use Illuminate\Database\Eloquent\Model; |
||||||
| 15 | |||||||
| 16 | class JudgerController extends AdminController |
||||||
| 17 | { |
||||||
| 18 | use HasResourceActions; |
||||||
| 19 | |||||||
| 20 | /** |
||||||
| 21 | * Index interface. |
||||||
| 22 | * |
||||||
| 23 | * @param Content $content |
||||||
| 24 | * @return Content |
||||||
| 25 | */ |
||||||
| 26 | public function index(Content $content) |
||||||
| 27 | { |
||||||
| 28 | return $content |
||||||
| 29 | ->header(__('admin.judgers.index.header')) |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 30 | ->description(__('admin.judgers.index.description')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.index.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 31 | ->body($this->grid()->render()); |
||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | /** |
||||||
| 35 | * Show interface. |
||||||
| 36 | * |
||||||
| 37 | * @param mixed $id |
||||||
| 38 | * @param Content $content |
||||||
| 39 | * @return Content |
||||||
| 40 | */ |
||||||
| 41 | public function show($id, Content $content) |
||||||
| 42 | { |
||||||
| 43 | return $content |
||||||
| 44 | ->header(__('admin.judgers.show.header')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.show.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 45 | ->description(__('admin.judgers.show.description')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.show.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 46 | ->body($this->detail($id)); |
||||||
| 47 | } |
||||||
| 48 | |||||||
| 49 | /** |
||||||
| 50 | * Edit interface. |
||||||
| 51 | * |
||||||
| 52 | * @param mixed $id |
||||||
| 53 | * @param Content $content |
||||||
| 54 | * @return Content |
||||||
| 55 | */ |
||||||
| 56 | public function edit($id, Content $content) |
||||||
| 57 | { |
||||||
| 58 | return $content |
||||||
| 59 | ->header(__('admin.judgers.edit.header')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.edit.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 60 | ->description(__('admin.judgers.edit.description')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.edit.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 61 | ->body($this->form()->edit($id)); |
||||||
| 62 | } |
||||||
| 63 | |||||||
| 64 | /** |
||||||
| 65 | * Create interface. |
||||||
| 66 | * |
||||||
| 67 | * @param Content $content |
||||||
| 68 | * @return Content |
||||||
| 69 | */ |
||||||
| 70 | public function create(Content $content) |
||||||
| 71 | { |
||||||
| 72 | return $content |
||||||
| 73 | ->header(__('admin.judgers.create.header')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.create.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 74 | ->description(__('admin.judgers.create.description')) |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.create.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 75 | ->body($this->form()); |
||||||
| 76 | } |
||||||
| 77 | |||||||
| 78 | /** |
||||||
| 79 | * Make a grid builder. |
||||||
| 80 | * |
||||||
| 81 | * @return Grid |
||||||
| 82 | */ |
||||||
| 83 | protected function grid() |
||||||
| 84 | { |
||||||
| 85 | $grid=new Grid(new Judger()); |
||||||
| 86 | |||||||
| 87 | $grid->column('jid', 'JID'); |
||||||
| 88 | $grid->column('handle', __('admin.judgers.handle'))->editable(); |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.handle') can also be of type array and array; however, parameter $label of Encore\Admin\Grid::column() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 89 | $grid->column('password', __('admin.judgers.password'))->editable(); |
||||||
| 90 | $grid->column('available', __('admin.judgers.availability'))->display(function($available) { |
||||||
| 91 | return $available ? '<i class="MDI check-circle wemd-teal-text"></i> '.__('admin.judgers.available') : '<i class="MDI close-circle wemd-pink-text"></i> '.__('admin.judgers.unavailable'); |
||||||
|
0 ignored issues
–
show
Are you sure
__('admin.judgers.available') of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
Are you sure
__('admin.judgers.unavailable') of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 92 | }); |
||||||
| 93 | $grid->column('oid', __('admin.judgers.oj'))->display(function() { |
||||||
| 94 | return $this->oj->name; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 95 | }); |
||||||
| 96 | $grid->column('user_id', __('admin.judgers.user_id'))->editable(); |
||||||
| 97 | $grid->column('created_at', __('admin.created_at')); |
||||||
| 98 | $grid->column('updated_at', __('admin.updated_at')); |
||||||
| 99 | |||||||
| 100 | $grid->filter(function(Grid\Filter $filter) { |
||||||
| 101 | $filter->like('handle', __('admin.judgers.handle')); |
||||||
| 102 | $filter->like('password', __('admin.judgers.password')); |
||||||
| 103 | $filter->like('user_id', __('admin.judgers.user_id')); |
||||||
| 104 | $filter->equal('oid', __('admin.judgers.oj'))->select(OJ::all()->pluck('name', 'oid')); |
||||||
| 105 | }); |
||||||
| 106 | |||||||
| 107 | return $grid; |
||||||
| 108 | } |
||||||
| 109 | |||||||
| 110 | /** |
||||||
| 111 | * Make a show builder. |
||||||
| 112 | * |
||||||
| 113 | * @param mixed $id |
||||||
| 114 | * @return Show |
||||||
| 115 | */ |
||||||
| 116 | protected function detail($id) |
||||||
| 117 | { |
||||||
| 118 | $show=new Show(Judger::findOrFail($id)); |
||||||
| 119 | |||||||
| 120 | $show->field('jid', 'JID'); |
||||||
| 121 | $show->field('handle', __('admin.judgers.handle')); |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.handle') can also be of type array and array; however, parameter $label of Encore\Admin\Show::field() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 122 | $show->field('password', __('admin.judgers.password')); |
||||||
| 123 | $show->field('available', __('admin.judgers.availability'))->as(function($available) { |
||||||
| 124 | return $available ?__('admin.judgers.available') : __('admin.judgers.unavailable'); |
||||||
| 125 | }); |
||||||
| 126 | $show->field('oj.name', __('admin.judgers.oj')); |
||||||
| 127 | $show->field('user_id', __('admin.judgers.user_id')); |
||||||
| 128 | $show->field('created_at', __('admin.created_at')); |
||||||
| 129 | $show->field('updated_at', __('admin.updated_at')); |
||||||
| 130 | |||||||
| 131 | return $show; |
||||||
| 132 | } |
||||||
| 133 | |||||||
| 134 | /** |
||||||
| 135 | * Make a form builder. |
||||||
| 136 | * |
||||||
| 137 | * @return Form |
||||||
| 138 | */ |
||||||
| 139 | protected function form() |
||||||
| 140 | { |
||||||
| 141 | $form=new Form(new Judger()); |
||||||
| 142 | $form->text('handle', __('admin.judgers.handle'))->help(__('admin.judgers.help.handle'))->required(); |
||||||
|
0 ignored issues
–
show
It seems like
__('admin.judgers.help.handle') can also be of type array and array; however, parameter $text of Encore\Admin\Form\Field::help() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 143 | $form->text('password', __('admin.judgers.password'))->help(__('admin.judgers.help.password'))->required(); |
||||||
| 144 | $form->switch('available', __('admin.judgers.availability'))->default(true); |
||||||
| 145 | $form->select('oid', __('admin.judgers.oj'))->options(OJ::all()->pluck('name', 'oid'))->required(); |
||||||
| 146 | $form->text('user_id', __('admin.judgers.user_id'))->help(__('admin.judgers.help.user_id')); |
||||||
| 147 | $form->hidden('using')->default(0); |
||||||
| 148 | return $form; |
||||||
| 149 | } |
||||||
| 150 | } |
||||||
| 151 |