Enforce maximum length of ban appeal

This commit is contained in:
discomrade 2021-07-24 10:47:56 -02:00
parent 4a4bb4e856
commit 4a5944795c
3 changed files with 18 additions and 6 deletions

View file

@ -1487,23 +1487,27 @@ function handle_appeal(){
}
if (!isset($ban)) {
error(_("That ban doesn't exist or is not for you."));
error($config['error']['noban']);
}
if ($ban['expires'] && $ban['expires'] - $ban['created'] <= $config['ban_appeals_min_length']) {
error(_("You cannot appeal a ban of this length."));
error($config['error']['tooshortban']);
}
$query = query("SELECT `denied` FROM ``ban_appeals`` WHERE `ban_id` = $ban_id") or error(db_error());
$ban_appeals = $query->fetchAll(PDO::FETCH_COLUMN);
if (count($ban_appeals) >= $config['ban_appeals_max']) {
error(_("You cannot appeal this ban again."));
error($config['error']['toomanyappeals']);
}
foreach ($ban_appeals as $is_denied) {
if (!$is_denied)
error(_("There is already a pending appeal for this ban."));
error($config['error']['pendingappeal']);
}
if (strlen($_POST['appeal']) > $config['ban_appeal_max_chars']) {
error($config['error']['toolongappeal']);
}
$query = prepare("INSERT INTO ``ban_appeals`` VALUES (NULL, :ban_id, :time, :message, 0)");