summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/mod/pages.php26
-rw-r--r--mod.php2
-rw-r--r--templates/mod/log.html7
-rw-r--r--templates/mod/user.html3
4 files changed, 36 insertions, 2 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 88ff3dd5..b167cb69 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -413,6 +413,32 @@ function mod_log($page_no = 1) {
mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count));
}
+function mod_user_log($username, $page_no = 1) {
+ global $config;
+
+ if ($page_no < 1)
+ error($config['error']['404']);
+
+ if (!hasPermission($config['mod']['modlog']))
+ error($config['error']['noaccess']);
+
+ $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `username` = :username ORDER BY `time` DESC LIMIT :offset, :limit");
+ $query->bindValue(':username', $username);
+ $query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT);
+ $query->bindValue(':offset', ($page_no - 1) * $config['mod']['modlog_page'], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+ $logs = $query->fetchAll(PDO::FETCH_ASSOC);
+
+ if (empty($logs) && $page_no > 1)
+ error($config['error']['404']);
+
+ $query = prepare("SELECT COUNT(*) FROM `modlogs`");
+ $query->execute() or error(db_error($query));
+ $count = $query->fetchColumn(0);
+
+ mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username));
+}
+
function mod_view_board($boardName, $page_no = 1) {
global $config, $mod;
diff --git a/mod.php b/mod.php
index 408c5c39..8f3a5001 100644
--- a/mod.php
+++ b/mod.php
@@ -39,6 +39,8 @@ $pages = array(
'/noticeboard/delete/(\d+)' => 'noticeboard_delete',// delete from noticeboard
'/log' => 'log', // modlog
'/log/(\d+)' => 'log', // modlog
+ '/log:([^/]+)' => 'user_log', // modlog
+ '/log:([^/]+)/(\d+)' => 'user_log', // modlog
'/news' => 'news', // view news
'/news/(\d+)' => 'news', // view news
'/news/delete/(\d+)' => 'news_delete', // delete from news
diff --git a/templates/mod/log.html b/templates/mod/log.html
index dca1b2d0..43541892 100644
--- a/templates/mod/log.html
+++ b/templates/mod/log.html
@@ -10,7 +10,10 @@
<tr>
<td class="minimal">
{% if log.username %}
- <a href="?/new_PM/{{ log.username|e }}">{{ log.username|e }}</a>
+ {{ log.username|e }}
+ <small>
+ <a href="?/new_PM/{{ log.username|e }}">[PM]</a>{% if not username %} <a href="?/log:{{ log.username|e }}">[&hellip;]</a>{% endif %}
+ </small>
{% elseif log.mod == -1 %}
<em>system</em>
{% else %}
@@ -40,7 +43,7 @@
{% if count > logs|count %}
<p class="unimportant" style="text-align:center;word-wrap:break-word">
{% for i in range(0, (count - 1) / config.mod.modlog_page) %}
- <a href="?/log/{{ i + 1 }}">[{{ i + 1 }}]</a>
+ <a href="?/log{% if username %}:{{ username }}{% endif %}/{{ i + 1 }}">[{{ i + 1 }}]</a>
{% endfor %}
</p>
{% endif %}
diff --git a/templates/mod/user.html b/templates/mod/user.html
index 3c4b89cf..1bb297af 100644
--- a/templates/mod/user.html
+++ b/templates/mod/user.html
@@ -121,5 +121,8 @@
</tr>
{% endfor %}
</table>
+ <p style="text-align:center" class="unimportant">
+ <a href="?/log:{{ user.username|e }}">{% trans 'View more logs for this user.' %}</a>
+ </p>
{% endif %}