diff --git a/inc/config.php b/inc/config.php
index f2aa74f1..c1f8dbc5 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -254,6 +254,8 @@
$config['mod']['search_results'] = 75;
// Maximum number of notices to display on the moderator noticeboard
$config['mod']['noticeboard_display'] = 50;
+ // Number of entries to summarize and display on the dashboard
+ $config['mod']['noticeboard_dashboard'] = 5;
// Probably best not to change these:
if(!defined('JANITOR')) {
diff --git a/mod.php b/mod.php
index a15c6a3f..9b649524 100644
--- a/mod.php
+++ b/mod.php
@@ -88,7 +88,40 @@
$fieldset['Boards'] .= ulBoards();
if($mod['type'] >= $config['mod']['noticeboard']) {
- $fieldset['Noticeboard'] .= '
View previous entries';
+ $query = prepare("SELECT * FROM `noticeboard` ORDER BY `id` DESC LIMIT :limit");
+ $query->bindValue(':limit', $config['mod']['noticeboard_dashboard'], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+
+ $fieldset['Noticeboard'] .= '';
+
+ $_body = '';
+ while($notice = $query->fetch()) {
+ $m_query = prepare("SELECT `username` FROM `mods` WHERE `id` = :id");
+ $m_query->bindValue(':id', $notice['mod'], PDO::PARAM_INT);
+ $m_query->execute() or error(db_error($m_query));
+ if(!$_mod = $m_query->fetch()) {
+ $_mod = Array('username' => '???');
+ }
+
+ $_body .= '' .
+ ($notice['subject'] ?
+ $notice['subject']
+ :
+ 'no subject'
+ ) .
+ ' — by ' .
+ $_mod['username'] .
+ ' at ' .
+ date($config['post_date'], $notice['time']) .
+ '';
+ }
+ if(!empty($_body)) {
+ $fieldset['Noticeboard'] .= '';
+ }
+
+ $fieldset['Noticeboard'] .= 'View all entires';
}
if($mod['type'] >= $config['mod']['reports']) {
@@ -197,7 +230,7 @@
$body = '';
if($mod['type'] >= $config['mod']['noticeboard_post']) {
- if(isset($_POST['subject']) && isset($_POST['body'])) {
+ if(isset($_POST['subject']) && isset($_POST['body']) && !empty($_POST['body'])) {
$query = prepare("INSERT INTO `noticeboard` VALUES (NULL, :mod, :time, :subject, :body)");
$query->bindValue(':mod', $mod['id'], PDO::PARAM_INT);
$query->bindvalue(':time', time(), PDO::PARAM_INT);
@@ -239,7 +272,7 @@
($mod['type'] >= $config['mod']['noticeboard_delete'] ?
'[delete]'
: '') .
- '' .
+ '' .
($notice['subject'] ?
$notice['subject']
: