summaryrefslogtreecommitdiff
path: root/inc/mod/pages.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-04-20 21:54:30 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-04-20 21:54:30 +1000
commit07fc56b80b36fcf41e8959844d1d8329a8852a99 (patch)
tree3b0e39d3242d5e95c00f03ef12844a8959ab5d49 /inc/mod/pages.php
parentde84ca6f755347b2c3fcf87165704a2d9e899d77 (diff)
Noticeboard on dashboard
Diffstat (limited to 'inc/mod/pages.php')
-rw-r--r--inc/mod/pages.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 78f560ec..e40dc241 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -61,10 +61,24 @@ function mod_confirm($request) {
}
function mod_dashboard() {
+ global $config;
+
$args = array();
$args['boards'] = listBoards();
+ if(hasPermission($config['mod']['noticeboard'])) {
+ if(!$config['cache']['enabled'] || !$args['noticeboard'] = cache::get('noticeboard_preview')) {
+ $query = prepare("SELECT `noticeboard`.*, `username` FROM `noticeboard` LEFT JOIN `mods` ON `mods`.`id` = `mod` ORDER BY `id` DESC LIMIT :limit");
+ $query->bindValue(':limit', $config['mod']['noticeboard_dashboard'], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+ $args['noticeboard'] = $query->fetchAll(PDO::FETCH_ASSOC);
+
+ if($config['cache']['enabled'])
+ cache::set('noticeboard_preview', $args['noticeboard']);
+ }
+ }
+
mod_page('Dashboard', 'mod/dashboard.html', $args);
}