diff --git a/inc/mod.php b/inc/mod.php
index 3d0c0d83..bce9e206 100644
--- a/inc/mod.php
+++ b/inc/mod.php
@@ -74,12 +74,16 @@
}
function modLog($action) {
- global $mod;
- $query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :time, :text)");
+ global $mod, $board;
+ $query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :board, :time, :text)");
$query->bindValue(':id', $mod['id'], PDO::PARAM_INT);
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':time', time(), PDO::PARAM_INT);
$query->bindValue(':text', $action);
+ if(isset($board))
+ $query->bindValue(':board', $board['id']);
+ else
+ $query->bindValue(':board', null, PDO::PARAM_NULL);
$query->execute() or error(db_error($query));
}
diff --git a/install.sql b/install.sql
index 8dae0201..6123bc6c 100644
--- a/install.sql
+++ b/install.sql
@@ -105,6 +105,7 @@ INSERT INTO `boards` (`id`, `uri`, `title`, `subtitle`) VALUES
CREATE TABLE IF NOT EXISTS `modlogs` (
`mod` int(11) NOT NULL,
`ip` varchar(45) NOT NULL,
+ `board` int(11) NOT NULL,
`time` int(11) NOT NULL,
`text` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/mod.php b/mod.php
index 3db8ea6d..57a8cdcb 100644
--- a/mod.php
+++ b/mod.php
@@ -128,9 +128,15 @@
} elseif(preg_match('/^\/log$/', $query)) {
if($mod['type'] < $config['mod']['modlog']) error($config['error']['noaccess']);
- $body = '
User | IP address | Ago | Action |
';
+ $boards = Array();
+ $_boards = listBoards();
+ foreach($_boards as &$_b) {
+ $boards[$_b['id']] = $_b['uri'];
+ }
- $query = prepare("SELECT `id`,`username`,`ip`,`time`,`text` FROM `modlogs` INNER JOIN `mods` ON `mod` = `id` ORDER BY `time` DESC LIMIT :limit");
+ $body = 'User | IP address | Ago | Board | Action |
';
+
+ $query = prepare("SELECT `mods`.`id`,`username`,`ip`,`board`,`time`,`text` FROM `modlogs` INNER JOIN `mods` ON `mod` = `mods`.`id` ORDER BY `time` DESC LIMIT :limit");
$query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
@@ -143,6 +149,12 @@
'' . $log['username'] . ' | ' .
'' . $log['ip'] . ' | ' .
'' . ago($log['time']) . ' | ' .
+ '' .
+ ($log['board'] ?
+ (isset($boards[$log['board']]) ?
+ '' . sprintf($config['board_abbreviation'], $boards[$log['board']]) . ' | '
+ : 'deleted?')
+ : '-') .
'' . $log['text'] . ' | ' .
'';
}
@@ -173,12 +185,17 @@
$query = prepare("DELETE FROM `pms` WHERE `id` = :id");
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
+
+ modLog('Deleted a PM');
+
header('Location: ?/', true, $config['redirect_http']);
} else {
$query = prepare("UPDATE `pms` SET `unread` = 0 WHERE `id` = :id");
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
+ modLog('Read a PM');
+
$body = '