mirror of
https://github.com/Circlepuller/Tinyboard.git
synced 2025-01-17 21:39:27 +01:00
Mod log viewer
This commit is contained in:
parent
11d358e510
commit
9703adb0e7
@ -235,6 +235,8 @@
|
|||||||
$config['mod']['ip_recentposts'] = 5;
|
$config['mod']['ip_recentposts'] = 5;
|
||||||
// How many posts to display on the reports page
|
// How many posts to display on the reports page
|
||||||
$config['mod']['recent_reports'] = 5;
|
$config['mod']['recent_reports'] = 5;
|
||||||
|
// How many actions to show per page in the moderation log
|
||||||
|
$config['mod']['modlog_page'] = 350;
|
||||||
|
|
||||||
// Probably best not to change these:
|
// Probably best not to change these:
|
||||||
if(!defined('JANITOR')) {
|
if(!defined('JANITOR')) {
|
||||||
@ -310,6 +312,8 @@
|
|||||||
$config['mod']['deleteusers'] = ADMIN;
|
$config['mod']['deleteusers'] = ADMIN;
|
||||||
// Create a user
|
// Create a user
|
||||||
$config['mod']['createusers'] = ADMIN;
|
$config['mod']['createusers'] = ADMIN;
|
||||||
|
// View the moderation log
|
||||||
|
$config['mod']['modlog'] = ADMIN;
|
||||||
|
|
||||||
// Mod links (full HTML)
|
// Mod links (full HTML)
|
||||||
// Correspond to above permission directives
|
// Correspond to above permission directives
|
||||||
|
40
mod.php
40
mod.php
@ -90,9 +90,12 @@
|
|||||||
if($mod['type'] >= $config['mod']['view_banlist']) {
|
if($mod['type'] >= $config['mod']['view_banlist']) {
|
||||||
$fieldset['Administration'] .= '<li><a href="?/bans">Ban list</a></li>';
|
$fieldset['Administration'] .= '<li><a href="?/bans">Ban list</a></li>';
|
||||||
}
|
}
|
||||||
if($mod['type'] >= $config['mod']['manageusers']) {
|
if($mod['type'] >= $config['mod']['manageusers']) {
|
||||||
$fieldset['Administration'] .= '<li><a href="?/users">Manage users</a></li>';
|
$fieldset['Administration'] .= '<li><a href="?/users">Manage users</a></li>';
|
||||||
}
|
}
|
||||||
|
if($mod['type'] >= $config['mod']['modlog']) {
|
||||||
|
$fieldset['Administration'] .= '<li><a href="?/log">Moderation log</a></li>';
|
||||||
|
}
|
||||||
if($mod['type'] >= $config['mod']['show_config']) {
|
if($mod['type'] >= $config['mod']['show_config']) {
|
||||||
$fieldset['Administration'] .= '<li><a href="?/config">Show configuration</a></li>';
|
$fieldset['Administration'] .= '<li><a href="?/config">Show configuration</a></li>';
|
||||||
}
|
}
|
||||||
@ -112,7 +115,40 @@
|
|||||||
//,'mod'=>true /* All 'mod' does, at this point, is put the "Return to dashboard" link in. */
|
//,'mod'=>true /* All 'mod' does, at this point, is put the "Return to dashboard" link in. */
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
} elseif(preg_match('/^\/log$/', $query)) {
|
||||||
|
if($mod['type'] < $config['mod']['modlog']) error($config['error']['noaccess']);
|
||||||
|
|
||||||
|
$body = '<table class="modlog"><tr><th>User</th><th>IP address</th><th>Ago</th><th>Action</th></tr>';
|
||||||
|
|
||||||
|
$query = prepare("SELECT `id`,`username`,`ip`,`time`,`text` FROM `modlogs` INNER JOIN `mods` ON `mod` = `id` ORDER BY `time` DESC LIMIT :limit");
|
||||||
|
$query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
|
while($log = $query->fetch()) {
|
||||||
|
$log['text'] = htmlentities($log['text']);
|
||||||
|
$log['text'] = preg_replace('/(\d+\.\d+\.\d+\.\d+)/', '<a href="?/IP/$1">$1</a>', $log['text']);
|
||||||
|
|
||||||
|
|
||||||
|
$body .= '<tr>' .
|
||||||
|
'<td class="minimal"><a href="?/users/' . $log['id'] . '">' . $log['username'] . '</a></td>' .
|
||||||
|
'<td class="minimal"><a href="?/IP/' . $log['ip'] . '">' . $log['ip'] . '</a></td>' .
|
||||||
|
'<td class="minimal">' . ago($log['time']) . '</td>' .
|
||||||
|
'<td>' . $log['text'] . '</td>' .
|
||||||
|
'</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$body .= '</table>';
|
||||||
|
|
||||||
|
echo Element('page.html', Array(
|
||||||
|
'index'=>$config['root'],
|
||||||
|
'title'=>'Moderation log',
|
||||||
|
'body'=>$body,
|
||||||
|
'mod'=>true
|
||||||
|
)
|
||||||
|
);
|
||||||
} elseif(preg_match('/^\/users$/', $query)) {
|
} elseif(preg_match('/^\/users$/', $query)) {
|
||||||
|
if($mod['type'] < $config['mod']['manageusers']) error($config['error']['noaccess']);
|
||||||
|
|
||||||
$body = '<form action="" method="post"><table><tr><th>ID</th><th>Username</th><th>Type</th><th>Last action</th><th>…</th></tr>';
|
$body = '<form action="" method="post"><table><tr><th>ID</th><th>Username</th><th>Type</th><th>Last action</th><th>…</th></tr>';
|
||||||
|
|
||||||
$query = query("SELECT *, (SELECT `time` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`, (SELECT `text` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action` FROM `mods` ORDER BY `type` DESC,`id`") or error(db_error());
|
$query = query("SELECT *, (SELECT `time` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`, (SELECT `text` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action` FROM `mods` ORDER BY `type` DESC,`id`") or error(db_error());
|
||||||
@ -899,7 +935,7 @@
|
|||||||
$ip = $post['ip'];
|
$ip = $post['ip'];
|
||||||
|
|
||||||
// Record the action
|
// Record the action
|
||||||
modLog("Deleted all posts by IP address: #{$ip}");
|
modLog("Deleted all posts by IP address: {$ip}");
|
||||||
|
|
||||||
$query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri']));
|
$query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri']));
|
||||||
$query->bindValue(':ip', $ip);
|
$query->bindValue(':ip', $ip);
|
||||||
|
21
style.css
21
style.css
@ -332,4 +332,25 @@ div.boardlist a {
|
|||||||
}
|
}
|
||||||
div.report {
|
div.report {
|
||||||
color: #333;
|
color: #333;
|
||||||
|
}
|
||||||
|
table.modlog {
|
||||||
|
margin: auto;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table.modlog tr td {
|
||||||
|
text-align: left;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 4px 15px 0 0;
|
||||||
|
}
|
||||||
|
table.modlog tr th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 4px 15px 5px 5px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
table.modlog tr th {
|
||||||
|
background: #98E;
|
||||||
|
}
|
||||||
|
td.minimal {
|
||||||
|
width: 1%;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user