diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index c62f7258..779a4789 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -49,6 +49,7 @@ $config['mod']['debug_antispam'] = ADMIN; $config['mod']['noticeboard_post'] = ADMIN; $config['mod']['modlog'] = GLOBALVOLUNTEER; + $config['mod']['mod_board_log'] = MOD; $config['mod']['editpost'] = BOARDVOLUNTEER; $config['mod']['edit_banners'] = MOD; $config['mod']['edit_flags'] = MOD; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 093454a8..3f82d974 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -639,7 +639,7 @@ function mod_log($page_no = 1) { $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); - mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count)); + mod_page(_('Board log'), 'mod/log.html', array('logs' => $logs, 'count' => $count)); } function mod_user_log($username, $page_no = 1) { @@ -666,7 +666,7 @@ function mod_user_log($username, $page_no = 1) { $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); - mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username)); + mod_page(_('Board log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username)); } function mod_board_log($board, $page_no = 1) { @@ -675,7 +675,7 @@ function mod_board_log($board, $page_no = 1) { if ($page_no < 1) error($config['error']['404']); - if (!hasPermission($config['mod']['modlog'])) + if (!hasPermission($config['mod']['mod_board_log'], $board)) error($config['error']['noaccess']); $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `board` = :board ORDER BY `time` DESC LIMIT :offset, :limit"); @@ -687,13 +687,22 @@ function mod_board_log($board, $page_no = 1) { if (empty($logs) && $page_no > 1) error($config['error']['404']); + + if (!hasPermission($config['mod']['show_ip'])) { + // Supports ipv4 only! + foreach ($logs as $i => &$log) { + $log['text'] = preg_replace_callback('/(?:)?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?:<\/a>)?/', function($matches) { + return less_ip($matches[1]); + }, $log['text']); + } + } $query = prepare("SELECT COUNT(*) FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `board` = :board"); $query->bindValue(':board', $board); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); - mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'board' => $board)); + mod_page(_('Board log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'board' => $board)); } function mod_view_board($boardName, $page_no = 1) { diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index 00bafdb7..a97f0480 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -72,7 +72,9 @@
  • {% trans 'Manage themes' %}
  • {% endif %} {% if mod|hasPermission(config.mod.modlog) %} -
  • {% trans 'Moderation log' %}
  • +
  • {% trans 'User actions log' %}
  • + {% elseif mod.boards[0] != '*' and mod.boards[0] and mod|hasPermission(config.mod.mod_board_log, mod.boards[0]) %} +
  • {% trans 'Board log' %}
  • {% endif %} {% if mod|hasPermission(config.mod.recent) %}
  • {% trans 'Recent posts' %}
  • diff --git a/templates/mod/log.html b/templates/mod/log.html index 40a646fd..5a306833 100644 --- a/templates/mod/log.html +++ b/templates/mod/log.html @@ -1,6 +1,6 @@ - + @@ -10,7 +10,11 @@
    {% trans 'Staff' %}{% trans 'Username' %} {% trans 'IP address' %} {% trans 'Time' %} {% trans 'Board' %}
    {% if log.username %} - {{ log.username|e }} + {% if not mod|hasPermission(config.mod.modlog) %} + {{ log.username|e }} + {% else %} + {{ log.username|e }} + {% endif %} {% elseif log.mod == -1 %} system {% else %} @@ -44,7 +48,7 @@ {% if count > logs|count %}

    {% for i in range(0, (count - 1) / config.mod.modlog_page) %} - [{{ i + 1 }}] + [{{ i + 1 }}] {% endfor %}

    {% endif %}