Update Pages\PostValidatorTrait
Add an external variable to calculate the interval.
This commit is contained in:
parent
da36db897f
commit
2629842326
1 changed files with 3 additions and 2 deletions
|
@ -80,13 +80,14 @@ trait PostValidatorTrait
|
|||
/**
|
||||
* Проверка времени ограничения флуда
|
||||
*/
|
||||
public function vCheckTimeout(Validator $v, $submit)
|
||||
public function vCheckTimeout(Validator $v, $submit, $attr, ?int $last)
|
||||
{
|
||||
if ($v->noValue($submit)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$time = \time() - (int) $this->user->last_post;
|
||||
$last = $last > 0 ? $last : $this->user->last_post;
|
||||
$time = \time() - $last;
|
||||
|
||||
if ($time < $this->user->g_post_flood) {
|
||||
$v->addError(['Flood message', $this->user->g_post_flood - $time], 'e');
|
||||
|
|
Loading…
Add table
Reference in a new issue