diff --git a/inc/display.php b/inc/display.php index 929d24c3..5578ffc1 100644 --- a/inc/display.php +++ b/inc/display.php @@ -401,7 +401,18 @@ class Post { public function build($index=false) { global $board, $config; - return Element($config['file_post_reply'], array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'mod' => $this->mod)); + $options = [ + 'config' => $config, + 'board' => $board, + 'post' => &$this, + 'index' => $index, + 'mod' => $this->mod + ]; + if ($this->mod) { + $options['pm'] = create_pm_header(); + } + + return Element($config['file_post_reply'], $options); } }; @@ -465,8 +476,21 @@ class Thread { event('show-thread', $this); + $options = [ + 'config' => $config, + 'board' => $board, + 'post' => &$this, + 'index' => $index, + 'hasnoko50' => $hasnoko50, + 'isnoko50' => $isnoko50, + 'mod' => $this->mod + ]; + if ($this->mod) { + $options['pm'] = create_pm_header(); + } + $file = ($index && $config['file_board']) ? $config['file_post_thread_fileboard'] : $config['file_post_thread']; - $built = Element($file, array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'hasnoko50' => $hasnoko50, 'isnoko50' => $isnoko50, 'mod' => $this->mod)); + $built = Element($file, $options); return $built; } diff --git a/inc/functions.php b/inc/functions.php index 738e63ec..30994b5d 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1301,7 +1301,14 @@ function index($page, $mod=false, $brief = false) { } if ($config['file_board']) { - $body = Element($config['file_fileboard'], array('body' => $body, 'mod' => $mod)); + $options = [ + 'body' => $body, + 'mod' => $mod + ]; + if ($mod) { + $options['pm'] = create_pm_header(); + } + $body = Element($config['file_fileboard'], $options); } return array( @@ -1620,7 +1627,7 @@ function incrementSpamHash($hash) { } function buildIndex($global_api = "yes") { - global $board, $config, $build_pages; + global $board, $config, $build_pages, $mod; $catalog_api_action = generation_strategy('sb_api', array($board['uri'])); @@ -1692,6 +1699,9 @@ function buildIndex($global_api = "yes") { $content['pages'][$page-1]['selected'] = true; $content['btn'] = getPageButtons($content['pages']); $content['antibot'] = $antibot; + if ($mod) { + $content['pm'] = create_pm_header(); + } file_write($filename, Element($config['file_board_index'], $content)); } @@ -2274,7 +2284,7 @@ function buildThread($id, $return = false, $mod = false) { $hasnoko50 = $thread->postCount() >= $config['noko50_min']; $antibot = $mod || $return ? false : create_antibot($board['uri'], $id); - $body = Element($config['file_thread'], array( + $options = [ 'board' => $board, 'thread' => $thread, 'body' => $thread->build(), @@ -2286,7 +2296,12 @@ function buildThread($id, $return = false, $mod = false) { 'antibot' => $antibot, 'boardlist' => createBoardlist($mod), 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) - )); + ]; + if ($mod) { + $options['pm'] = create_pm_header(); + } + + $body = Element($config['file_thread'], $options); // json api if ($config['api']['enabled'] && !$mod) { @@ -2323,7 +2338,7 @@ function buildThread($id, $return = false, $mod = false) { } function buildThread50($id, $return = false, $mod = false, $thread = null, $antibot = false) { - global $board, $config, $build_pages; + global $board, $config; $id = round($id); if ($antibot) @@ -2381,7 +2396,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti $hasnoko50 = $thread->postCount() >= $config['noko50_min']; - $body = Element($config['file_thread'], array( + $options = [ 'board' => $board, 'thread' => $thread, 'body' => $thread->build(false, true), @@ -2393,7 +2408,12 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti 'antibot' => $mod ? false : ($antibot ? $antibot : create_antibot($board['uri'], $id)), 'boardlist' => createBoardlist($mod), 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) - )); + ]; + if ($mod) { + $options['pm'] = create_pm_header(); + } + + $body = Element($config['file_thread'], $options); if ($return) { return $body; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index e7a8becd..b9ea20ae 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -28,6 +28,7 @@ function mod_page($title, $template, $args, $subtitle = false) { 'title' => $title, 'subtitle' => $subtitle, 'boardlist' => createBoardlist($mod), + 'pm' => create_pm_header(), 'body' => Element($template, array_merge( array('config' => $config, 'mod' => $mod), @@ -511,7 +512,7 @@ function mod_new_board(Context $ctx) { if (!openBoard($_POST['uri'])) error(_("Couldn't open board after creation.")); - $query = Element('posts.sql', array('board' => $board['uri'])); + $query = Element('posts.sql', [ 'board' => $board['uri'] ]); if (mysql_version() < 50503) $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query); @@ -785,6 +786,7 @@ function mod_view_board(Context $ctx, $boardName, $page_no = 1) { $page['btn'] = getPageButtons($page['pages'], true); $page['mod'] = true; $page['config'] = $config; + $page['pm'] = create_pm_header(); echo Element($config['file_board_index'], $page); } @@ -2358,6 +2360,7 @@ function mod_reports(Context $ctx) { 'report' => $report, 'config' => $config, 'mod' => $mod, + 'pm' => create_pm_header(), 'token' => make_secure_link_token('reports/' . $report['id'] . '/dismiss'), 'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismiss&all'), 'token_post' => make_secure_link_token('reports/'. $report['id'] . '/dismiss&post'), @@ -2609,6 +2612,7 @@ function mod_config(Context $ctx, $board_config = false) {
You may proceed with these changes manually by copying and pasting the following code to the end of ' . $config_file . ':
'; + $page['pm'] = create_pm_header(); echo Element($config['file_page_template'], $page); exit; } @@ -2869,7 +2873,13 @@ function mod_edit_page(Context $ctx, $id) { $fn = (isset($board['uri']) ? ($board['uri'] . '/') : '') . $page['name'] . '.html'; $body = "