diff options
| author | czaks <marcin@6irc.net> | 2013-09-17 19:12:19 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-09-17 19:12:19 -0400 |
| commit | 8ca495e5b8c8382dbfeebc4990f0accc80101a46 (patch) | |
| tree | f0fec3bb1fb9abdb81ce1e89c678b4b2e62b874e /inc/functions.php | |
| parent | 9516aa199730115014538314dd46a5eaf3b12d20 (diff) | |
| parent | 840e8cd0936ad9577a6cecf56120716af77bdf6a (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard into vichan-devel-4.5
Conflicts:
inc/config.php
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php index ac74ac91..e695cf5e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -620,22 +620,41 @@ 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; + } + + if ($ban['post']['thread']) { + $post = new Post($ban['post']); + } else { + $post = new Thread($ban['post'], null, false, false); + } + } // 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, + 'board' => $board, + 'post' => isset($post) ? $post->build(true) : false ) )) )); |
