mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-07 16:24:43 +03:00
Add ability to ban forever
This commit is contained in:
parent
0edc9657b4
commit
4d32e942a3
@ -243,7 +243,7 @@ class Ban
|
|||||||
*/
|
*/
|
||||||
public function isExpired()
|
public function isExpired()
|
||||||
{
|
{
|
||||||
return ($this->till < time());
|
return ($this->till > 0 && $this->till < time());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +129,7 @@ class BanController extends AbstractController
|
|||||||
|
|
||||||
$page['banId'] = $ban->id;
|
$page['banId'] = $ban->id;
|
||||||
$page['formaddress'] = $ban->address;
|
$page['formaddress'] = $ban->address;
|
||||||
$page['formdays'] = round(($ban->till - time()) / 86400);
|
$page['formdays'] = $ban->till > 0 ? round(($ban->till - time()) / 86400) : 0;
|
||||||
$page['formcomment'] = $ban->comment;
|
$page['formcomment'] = $ban->comment;
|
||||||
} elseif ($request->query->has('thread')) {
|
} elseif ($request->query->has('thread')) {
|
||||||
// Prepopulate form using thread data
|
// Prepopulate form using thread data
|
||||||
@ -231,7 +231,7 @@ class BanController extends AbstractController
|
|||||||
throw new NotFoundException('The ban is not found.');
|
throw new NotFoundException('The ban is not found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ban->till = time() + $days * 24 * 60 * 60;
|
$ban->till = $days > 0 ? time() + $days * 24 * 60 * 60 : 0;
|
||||||
$ban->address = $address;
|
$ban->address = $address;
|
||||||
$ban->comment = $comment;
|
$ban->comment = $comment;
|
||||||
$ban->save();
|
$ban->save();
|
||||||
|
Loading…
Reference in New Issue
Block a user