123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- /**
- * This file is part of the ForkBB <https://github.com/forkbb>.
- *
- * @copyright (c) Visman <mio.visman@yandex.ru, https://github.com/MioVisman>
- * @license The MIT License (MIT)
- */
- declare(strict_types=1);
- namespace ForkBB\Models\Pages;
- use ForkBB\Models\Page;
- use function \ForkBB\__;
- class Rules extends Page
- {
- /**
- * Подготавливает данные для шаблона
- */
- public function view(): Page
- {
- $this->fIndex = self::FI_RULES;
- $this->nameTpl = 'rules';
- $this->onlinePos = 'rules';
- $this->onlineDetail = null;
- $this->canonical = $this->c->Router->link('Rules');
- $this->crumbs = $this->crumbs(
- [
- $this->c->Router->link('Rules'),
- 'Forum rules',
- ]
- );
- $this->rules = $this->c->config->o_rules_message;
- return $this;
- }
- /**
- * Подготавливает данные для шаблона
- */
- public function confirmation(): Page
- {
- $this->c->Lang->load('register');
- $this->fIndex = self::FI_REG;
- $this->nameTpl = 'rules';
- $this->onlinePos = 'rules';
- $this->onlineDetail = null;
- $this->robots = 'noindex';
- $this->crumbs = $this->crumbs(
- 'Forum rules',
- [
- $this->c->Router->link('Register'),
- 'Register',
- ]
- );
- $this->rules = 1 === $this->c->config->b_rules ? $this->c->config->o_rules_message : __('If no rules');
- $this->form = $this->formAgree();
- return $this;
- }
- /**
- * Подготавливает массив данных для формы
- */
- protected function formAgree(): array
- {
- return [
- 'action' => $this->c->Router->link('RegisterForm'),
- 'hidden' => [
- 'token' => $this->c->Csrf->create('RegisterForm'),
- ],
- 'sets' => [
- 'agree' => [
- 'fields' => [
- 'agree' => [
- 'type' => 'checkbox',
- 'label' => 'Agree',
- 'value' => $this->c->Csrf->create('Register'),
- ],
- ],
- ],
- ],
- 'btns' => [
- 'register' => [
- 'type' => 'submit',
- 'value' => __('Register'),
- ],
- ],
- ];
- }
- }
|