diff --git a/app/Models/Pages/Rules.php b/app/Models/Pages/Rules.php index 484b6448123adf473b338cf72ea2f0688a010ccf..42eae80a60708bc3c8fcff5153412b75b9817c0f 100644 --- a/app/Models/Pages/Rules.php +++ b/app/Models/Pages/Rules.php @@ -20,7 +20,6 @@ class Rules extends Page $this->title = \ForkBB\__('Forum rules'); $this->crumbs = $this->crumbs([$this->c->Router->link('Rules'), \ForkBB\__('Forum rules')]); $this->rules = $this->c->config->o_rules_message; - $this->formAction = null; return $this; } @@ -41,10 +40,41 @@ class Rules extends Page $this->title = \ForkBB\__('Forum rules'); $this->crumbs = $this->crumbs(\ForkBB\__('Forum rules'), [$this->c->Router->link('Register'), \ForkBB\__('Register')]); $this->rules = $this->c->config->o_rules == '1' ? $this->c->config->o_rules_message : \ForkBB\__('If no rules'); - $this->formAction = $this->c->Router->link('RegisterForm'); - $this->formToken = $this->c->Csrf->create('RegisterForm'); - $this->formHash = $this->c->Csrf->create('Register'); + $this->form = $this->formAgree(); return $this; } + + /** + * Подготавливает массив данных для формы + * + * @return array + */ + protected function formAgree() + { + return [ + 'action' => $this->c->Router->link('RegisterForm'), + 'hidden' => [ + 'token' => $this->c->Csrf->create('RegisterForm'), + ], + 'sets' => [ + 'agree' => [ + 'fields' => [ + 'agree' => [ + 'type' => 'checkbox', + 'label' => \ForkBB\__('Agree'), + 'value' => $this->c->Csrf->create('Register'), + ], + ], + ], + ], + 'btns' => [ + 'register' => [ + 'type' => 'submit', + 'value' => \ForkBB\__('Register'), + 'accesskey' => 's', + ], + ], + ]; + } } diff --git a/app/templates/rules.forkbb.php b/app/templates/rules.forkbb.php index 51e5ca31e63db57f848f5574ac028fb0b2bc8c70..09596e04837b4e7334774a916d0b653145f4505e 100644 --- a/app/templates/rules.forkbb.php +++ b/app/templates/rules.forkbb.php @@ -18,20 +18,9 @@

{!! $p->title !!}

{!! $p->rules !!}
-@if ($p->formAction) +@if ($form = $p->form)
-
- -
-
-
-
-
-
-

- -

-
+ @include('layouts/form')
@endif