Enforce maximum length of ban appeal

This commit is contained in:
discomrade
2021-07-24 10:47:56 -02:00
committed by Zankaria
parent 3ac86a074a
commit e80549a881
3 changed files with 19 additions and 6 deletions

View File

@@ -1367,23 +1367,28 @@ if (isset($_POST['delete'])) {
}
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."));
if (!$is_denied) {
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)");