Merge pull request #696 from Zankaria/ban-appeals-limits

Add maximum length of ban appeal
This commit is contained in:
Lorenzo Yario
2024-03-15 09:48:25 -07:00
committed by GitHub
3 changed files with 19 additions and 6 deletions

View File

@@ -1371,23 +1371,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)");