From c5aa3fdcc19fa9d845676307c8fc0e9270e628ae Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 19 Feb 2011 20:16:13 +1100 Subject: [PATCH] Added boardlinks --- inc/display.php | 26 ++++++++++++++++++++++++++ inc/functions.php | 10 +++++++++- templates/index.html | 1 + templates/thread.html | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/inc/display.php b/inc/display.php index 1ee16c05..0def6cda 100644 --- a/inc/display.php +++ b/inc/display.php @@ -18,6 +18,32 @@ $n = strval($n); return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3); } + + function doBoardListPart($list, $root) { + global $config; + + $body = ''; + foreach($list as $board) { + if(is_array($board)) + $body .= ' [' . doBoardListPart($board, $root) . '] '; + else { + $body .= ' ' . $board . ' /'; + } + } + $body = preg_replace('/\/$/', '', $body); + + return $body; + } + + function createBoardlist($mod=false) { + global $config; + + if(!isset($config['boards'])) return ''; + + $body = doBoardListPart($config['boards'], $mod?'?/':$config['root']); + + return '
' . $body . '
'; + } function error($message) { global $board, $mod, $config; diff --git a/inc/functions.php b/inc/functions.php index 2cb55016..ed50731c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -476,7 +476,14 @@ $body .= $thread->build(true); } - return Array('button'=>$config['button_newtopic'], 'board'=>$board, 'body'=>$body, 'post_url' => $config['post_url'], 'index' => $config['root']); + return Array( + 'button'=>$config['button_newtopic'], + 'board'=>$board, + 'body'=>$body, + 'post_url' => $config['post_url'], + 'index' => $config['root'], + 'boardlist' => createBoardlist($mod) + ); } function getPageButtons($pages, $mod=false) { @@ -967,6 +974,7 @@ 'index' => $config['root'], 'id' => $id, 'mod' => $mod, + 'boardlist' => createBoardlist($mod), 'hidden_inputs' => $content['hidden_inputs'] = createHiddenInputs(), 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['uri'] . '/' . $config['file_index']) )); diff --git a/templates/index.html b/templates/index.html index fe5ff719..bc4d44e5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,6 +8,7 @@ + {boardlist}

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

diff --git a/templates/thread.html b/templates/thread.html index 02d16c95..59843a5c 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -8,6 +8,7 @@ + {boardlist}

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}