Add output of http headers from engine config

The default set is "common". In the admin panel, profile, registration and login - "secury".
This commit is contained in:
Visman 2021-01-09 20:06:37 +07:00
parent 3708d0d318
commit bb385ea147
6 changed files with 26 additions and 11 deletions

View file

@ -45,16 +45,17 @@ abstract class Page extends Model
$formats[1] = __($formats[1]);
$container->TIME_FORMATS = $formats;
$this->fIndex = 'index'; # string Указатель на активный пункт навигации
$this->httpStatus = 200; # int HTTP статус ответа для данной страницы
# $this->nameTpl = null; # null|string Имя шаблона
# $this->titles = []; # array Массив титула страницы | setTitles()
$this->fIswev = []; # array Массив info, success, warning, error, validation информации
# $this->onlinePos = ''; # null|string Позиция для таблицы онлайн текущего пользователя
$this->onlineDetail = false; # bool Формировать данные по посетителям online или нет
$this->onlineFilter = true; # bool Посетители только по текущей странице или по всем
# $this->robots = ''; # string Переменная для meta name="robots"
# $this->canonical = ''; # string Переменная для link rel="canonical"
$this->fIndex = 'index'; # string Указатель на активный пункт навигации
$this->httpStatus = 200; # int HTTP статус ответа для данной страницы
# $this->nameTpl = null; # null|string Имя шаблона
# $this->titles = []; # array Массив титула страницы | setTitles()
$this->fIswev = []; # array Массив info, success, warning, error, validation информации
# $this->onlinePos = ''; # null|string Позиция для таблицы онлайн текущего пользователя
$this->onlineDetail = false; # bool Формировать данные по посетителям online или нет
$this->onlineFilter = true; # bool Посетители только по текущей странице или по всем
# $this->robots = ''; # string Переменная для meta name="robots"
# $this->canonical = ''; # string Переменная для link rel="canonical"
$this->hhsLevel = 'common'; # string Ключ для $c->HTTP_HEADERS (для вывода заголовков HTTP из конфига)
$this->fTitle = $container->config->o_board_title;
$this->fDescription = $container->config->o_board_desc;
@ -355,7 +356,10 @@ abstract class Page extends Model
if (null === $value) {
unset($this->httpHeaders[$key]);
} elseif (true === $replace || empty($this->httpHeaders[$key])) {
} elseif (
true === $replace
|| empty($this->httpHeaders[$key])
) {
$this->httpHeaders[$key] = [
["{$header} {$value}", $replace],
];
@ -372,6 +376,10 @@ abstract class Page extends Model
*/
protected function gethttpHeaders(): array
{
foreach ($this->c->HTTP_HEADERS[$this->hhsLevel] as $header => $value) {
$this->header($header, $value);
}
$this->httpStatus();
return $this->httpHeaders;

View file

@ -29,6 +29,7 @@ class Admin extends Page
$this->fIndex = 'admin';
$this->onlinePos = 'admin';
$this->robots = 'noindex, nofollow';
$this->hhsLevel = 'secure';
$container->Lang->load('admin');
}

View file

@ -72,6 +72,7 @@ class Auth extends Page
$ref = $this->c->Secury->replInvalidChars($_SERVER['HTTP_REFERER'] ?? '');
$this->hhsLevel = 'secure';
$this->fIndex = 'login';
$this->nameTpl = 'login';
$this->onlinePos = 'login';
@ -245,6 +246,7 @@ class Auth extends Page
$this->fIswev = $v->getErrors();
}
$this->hhsLevel = 'secure';
$this->fIndex = 'login';
$this->nameTpl = 'passphrase_reset';
$this->onlinePos = 'passphrase_reset';
@ -355,6 +357,7 @@ class Auth extends Page
$this->fIswev = ['i', __('Account activated')];
}
$this->hhsLevel = 'secure';
$this->fIndex = 'login';
$this->nameTpl = 'change_passphrase';
$this->onlinePos = 'change_passphrase';

View file

@ -37,6 +37,7 @@ abstract class Profile extends Page
$this->c->Lang->load('profile');
$this->hhsLevel = 'secure';
$this->rules = $this->c->ProfileRules->setUser($this->curUser);
$this->robots = 'noindex';
$this->fIndex = $this->rules->my ? 'profile' : 'userlist';

View file

@ -25,6 +25,7 @@ class View extends Profile
return $this->c->Message->message('Bad request');
}
$this->hhsLevel = 'common'; // для остальных страниц профиля уровень задан в initProfile()
$this->canonical = $this->curUser->link;
$this->robots = null;
$this->crumbs = $this->crumbs();

View file

@ -64,6 +64,7 @@ class Register extends Page
return $this->c->Message->message('Reg cancel', true, 403);
}
$this->hhsLevel = 'secure';
$this->fIndex = 'register';
$this->nameTpl = 'register';
$this->onlinePos = 'register';