Browse Source

%length% in public ban messages

pull/40/head
Michael Foster 11 years ago
parent
commit
33a1c00bd5
  1. 4
      inc/config.php
  2. 3
      inc/mod/pages.php

4
inc/config.php

@ -879,8 +879,10 @@
// Check public ban message by default
$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 %LENGTH% FOR THIS POST'; // Include length in ban message
// What to append to the post for public bans ("%s" is the message)
$config['mod']['ban_message'] = '<span class="public_ban">(%s)</span>';

3
inc/mod/pages.php

@ -1152,6 +1152,9 @@ function mod_ban_post($board, $delete, $post, $token = false) {
if (isset($_POST['public_message'], $_POST['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->bindValue(':id', $post);
$query->bindValue(':body', sprintf($config['mod']['ban_message'], utf8tohtml($_POST['message'])));

Loading…
Cancel
Save