diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-18 08:47:34 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-18 08:47:34 +1000 |
| commit | 3471f7c6684b12b63626af33ae408fd13544cae9 (patch) | |
| tree | 4536ea053a5c01548d6de1c43c1e5a7699f65050 /inc/functions.php | |
| parent | 803f0c8ce1487ea791824197de9d1ee140127838 (diff) | |
Optionally show post user was banned for
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php index f7421f68..bc159e88 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -617,22 +617,35 @@ function ago($timestamp) { } function displayBan($ban) { - global $config; + global $config, $board; if (!$ban['seen']) { Bans::seen($ban['id']); } $ban['ip'] = $_SERVER['REMOTE_ADDR']; - + if ($ban['post'] && isset($ban['post']['board'], $ban['post']['id'])) { + openBoard($ban['post']['board']); + + $query = query(sprintf("SELECT `thumb`, `file` FROM ``posts_%s`` WHERE `id` = " . (int)$ban['post']['id'], $board['uri'])); + if ($_post = $query->fetch(PDO::FETCH_ASSOC)) { + $ban['post'] = array_merge($ban['post'], $_post); + } else { + $ban['post']['file'] = 'deleted'; + $ban['post']['thumb'] = false; + } + $post = new Post($ban['post']); + } // Show banned page and exit die( Element('page.html', array( 'title' => _('Banned!'), 'config' => $config, + 'nojavascript' => true, 'body' => Element('banned.html', array( 'config' => $config, - 'ban' => $ban + 'ban' => $ban, + 'post' => isset($post) ? $post->build() : false ) )) )); |
