mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-19 01:24:05 +01:00
New feature: Board owner logs of their board
This commit is contained in:
parent
61fd6ef25c
commit
3e0134e53e
@ -49,6 +49,7 @@
|
|||||||
$config['mod']['debug_antispam'] = ADMIN;
|
$config['mod']['debug_antispam'] = ADMIN;
|
||||||
$config['mod']['noticeboard_post'] = ADMIN;
|
$config['mod']['noticeboard_post'] = ADMIN;
|
||||||
$config['mod']['modlog'] = GLOBALVOLUNTEER;
|
$config['mod']['modlog'] = GLOBALVOLUNTEER;
|
||||||
|
$config['mod']['mod_board_log'] = MOD;
|
||||||
$config['mod']['editpost'] = BOARDVOLUNTEER;
|
$config['mod']['editpost'] = BOARDVOLUNTEER;
|
||||||
$config['mod']['edit_banners'] = MOD;
|
$config['mod']['edit_banners'] = MOD;
|
||||||
$config['mod']['edit_flags'] = MOD;
|
$config['mod']['edit_flags'] = MOD;
|
||||||
|
@ -639,7 +639,7 @@ function mod_log($page_no = 1) {
|
|||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$count = $query->fetchColumn();
|
$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) {
|
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));
|
$query->execute() or error(db_error($query));
|
||||||
$count = $query->fetchColumn();
|
$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) {
|
function mod_board_log($board, $page_no = 1) {
|
||||||
@ -675,7 +675,7 @@ function mod_board_log($board, $page_no = 1) {
|
|||||||
if ($page_no < 1)
|
if ($page_no < 1)
|
||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
if (!hasPermission($config['mod']['modlog']))
|
if (!hasPermission($config['mod']['mod_board_log'], $board))
|
||||||
error($config['error']['noaccess']);
|
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");
|
$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)
|
if (empty($logs) && $page_no > 1)
|
||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
|
if (!hasPermission($config['mod']['show_ip'])) {
|
||||||
|
// Supports ipv4 only!
|
||||||
|
foreach ($logs as $i => &$log) {
|
||||||
|
$log['text'] = preg_replace_callback('/(?:<a href="\?\/IP\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}">)?(\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 = prepare("SELECT COUNT(*) FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `board` = :board");
|
||||||
$query->bindValue(':board', $board);
|
$query->bindValue(':board', $board);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$count = $query->fetchColumn();
|
$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) {
|
function mod_view_board($boardName, $page_no = 1) {
|
||||||
|
@ -72,7 +72,9 @@
|
|||||||
<li><a href="?/themes">{% trans 'Manage themes' %}</a></li>
|
<li><a href="?/themes">{% trans 'Manage themes' %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if mod|hasPermission(config.mod.modlog) %}
|
{% if mod|hasPermission(config.mod.modlog) %}
|
||||||
<li><a href="?/log">{% trans 'Moderation log' %}</a></li>
|
<li><a href="?/log">{% trans 'User actions log' %}</a></li>
|
||||||
|
{% elseif mod.boards[0] != '*' and mod.boards[0] and mod|hasPermission(config.mod.mod_board_log, mod.boards[0]) %}
|
||||||
|
<li><a href="?/log:b:{{ mod.boards[0] }}">{% trans 'Board log' %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if mod|hasPermission(config.mod.recent) %}
|
{% if mod|hasPermission(config.mod.recent) %}
|
||||||
<li><a href="?/recent/25">{% trans 'Recent posts' %}</a></li>
|
<li><a href="?/recent/25">{% trans 'Recent posts' %}</a></li>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<table class="modlog">
|
<table class="modlog">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans 'Staff' %}</th>
|
<th>{% trans 'Username' %}</th>
|
||||||
<th>{% trans 'IP address' %}</th>
|
<th>{% trans 'IP address' %}</th>
|
||||||
<th>{% trans 'Time' %}</th>
|
<th>{% trans 'Time' %}</th>
|
||||||
<th>{% trans 'Board' %}</th>
|
<th>{% trans 'Board' %}</th>
|
||||||
@ -10,7 +10,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="minimal">
|
<td class="minimal">
|
||||||
{% if log.username %}
|
{% if log.username %}
|
||||||
<a href="?/log:{{ log.username|e }}">{{ log.username|e }}</a>
|
{% if not mod|hasPermission(config.mod.modlog) %}
|
||||||
|
<a href="?/new_PM/{{ log.username|e }}">{{ log.username|e }}</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="?/log:{{ log.username|e }}">{{ log.username|e }}</a>
|
||||||
|
{% endif %}
|
||||||
{% elseif log.mod == -1 %}
|
{% elseif log.mod == -1 %}
|
||||||
<em>system</em>
|
<em>system</em>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -44,7 +48,7 @@
|
|||||||
{% if count > logs|count %}
|
{% if count > logs|count %}
|
||||||
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
||||||
{% for i in range(0, (count - 1) / config.mod.modlog_page) %}
|
{% for i in range(0, (count - 1) / config.mod.modlog_page) %}
|
||||||
<a href="?/log{% if username %}:{{ username }}{% endif %}/{{ i + 1 }}">[{{ i + 1 }}]</a>
|
<a href="?/log{% if username %}:{{ username }}{% elseif board %}:b:{{ board }}{% endif %}/{{ i + 1 }}">[{{ i + 1 }}]</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user