Merge pull request #348 from discomrade/ban-appeal-limit

Enforce maximum length of ban appeal
This commit is contained in:
nonmakina 2021-07-24 17:27:01 +02:00 committed by GitHub
commit 843ab6f55e
3 changed files with 17 additions and 5 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)");