1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 18:47:20 +01:00

%length% in public ban messages

This commit is contained in:
Michael Foster 2013-07-24 11:30:01 -04:00
parent 8edf7c7958
commit 8daaaf350a
2 changed files with 6 additions and 1 deletions

View File

@ -879,8 +879,10 @@
// Check public ban message by default // Check public ban message by default
$config['mod']['check_ban_message'] = false; $config['mod']['check_ban_message'] = false;
// Default public ban message // Default public ban message.
// In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent).
$config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST'; $config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST';
// $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; // Include length in ban message
// What to append to the post for public bans ("%s" is the message) // What to append to the post for public bans ("%s" is the message)
$config['mod']['ban_message'] = '<span class="public_ban">(%s)</span>'; $config['mod']['ban_message'] = '<span class="public_ban">(%s)</span>';

View File

@ -1152,6 +1152,9 @@ function mod_ban_post($board, $delete, $post, $token = false) {
if (isset($_POST['public_message'], $_POST['message'])) { if (isset($_POST['public_message'], $_POST['message'])) {
// public ban message // public ban message
$length_english = parse_time($_POST['length']) ? 'for ' . until(parse_time($_POST['length'])) : 'permanently';
$_POST['message'] = str_replace('%length%', $length_english, $_POST['message']);
$_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']);
$query = prepare(sprintf('UPDATE `posts_%s` SET `body` = CONCAT(`body`, :body) WHERE `id` = :id', $board)); $query = prepare(sprintf('UPDATE `posts_%s` SET `body` = CONCAT(`body`, :body) WHERE `id` = :id', $board));
$query->bindValue(':id', $post); $query->bindValue(':id', $post);
$query->bindValue(':body', sprintf($config['mod']['ban_message'], utf8tohtml($_POST['message']))); $query->bindValue(':body', sprintf($config['mod']['ban_message'], utf8tohtml($_POST['message'])));