diff --git a/app/Core/View.php b/app/Core/View.php index 530ff050..9c5a93dd 100644 --- a/app/Core/View.php +++ b/app/Core/View.php @@ -94,6 +94,29 @@ EOD; return $this->block('content'); } + /** + * Compile echos + */ + protected function compileEchos(string $value): string + { + $value = \preg_replace_callback( + '%(@)?\{\{!\s*(.+?)\s*!\}\}(\r?\n)?%s', + function($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3] . $matches[3]; + + return $matches[1] + ? \substr($matches[0], 1) + : '= \\htmlspecialchars((string) ' + . $this->compileEchoDefaults($matches[2]) + . ', \\ENT_HTML5 | \\ENT_QUOTES | \\ENT_SUBSTITUTE, \'UTF-8\', false) ?>' + . $whitespace; + }, + $value + ); + + return parent::compileEchos($value); + } + /** * Отправляет HTTP заголовки */ diff --git a/app/Models/Pages/Search.php b/app/Models/Pages/Search.php index 748bd423..7a6246bb 100644 --- a/app/Models/Pages/Search.php +++ b/app/Models/Pages/Search.php @@ -400,7 +400,7 @@ class Search extends Page if ( '*' !== $name - && \preg_match('%[@\'"<>\\/\x00-\x1F]%', $name) + && \preg_match('%[@"<>\\/\x00-\x1F]%', $name) ) { $v->addError('The :alias is not valid format'); } diff --git a/app/Models/Validators/Username.php b/app/Models/Validators/Username.php index 9dea616f..235a2394 100644 --- a/app/Models/Validators/Username.php +++ b/app/Models/Validators/Username.php @@ -36,7 +36,7 @@ class Username extends RulesValidator if ($this->c->user->isAdmin) { $max = 190; - $pattern = '%^[^@\'"<>\\/\x00-\x1F]+$%D'; + $pattern = '%^[^@"<>\\/\x00-\x1F]+$%D'; } else { $max = $this->c->USERNAME['max']; $pattern = $this->c->USERNAME['phpPattern']; @@ -51,7 +51,7 @@ class Username extends RulesValidator // паттерн не совпал } elseif ( ! \preg_match($pattern, $username) - || \preg_match('%[@\'"<>\\/\x00-\x1F]%', $username) + || \preg_match('%[@"<>\\/\x00-\x1F]%', $username) ) { $v->addError('Login format'); // идущие подряд пробелы diff --git a/app/templates/layouts/main.forkbb.php b/app/templates/layouts/main.forkbb.php index baff7432..1ecfbd5a 100644 --- a/app/templates/layouts/main.forkbb.php +++ b/app/templates/layouts/main.forkbb.php @@ -3,7 +3,7 @@
-