diff --git a/app/Models/Pages/Rules.php b/app/Models/Pages/Rules.php index 484b6448..42eae80a 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 51e5ca31..09596e04 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