From 92bbc50e7819a8c5725811695dc31e7621bb6acd Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Wed, 30 Dec 2020 03:39:19 -0500 Subject: [PATCH] Add foreign boards option to config - this will append links to other websites at the end of the board list - added getchan.net's /GET/ and /ref/ --- inc/display.php | 20 +++++++++ inc/instance-config.php | 93 ++++++++++++++++++++++------------------- 2 files changed, 69 insertions(+), 44 deletions(-) diff --git a/inc/display.php b/inc/display.php index db6e7ef2..0c846cf9 100644 --- a/inc/display.php +++ b/inc/display.php @@ -50,6 +50,7 @@ function doBoardListPart($list, $root, &$boards) { } } } + $body = preg_replace('/\/$/', '', $body); return $body; @@ -68,6 +69,25 @@ function createBoardlist($mod=false) { $body = doBoardListPart($config['boards'], $mod?'?/':$config['root'], $boards); + if (isset($config['foreign_boards'])) { + + $body .= ' ['; + + // Append links to foreign boards + $i = 0; + foreach ($config['foreign_boards'] as $fboardname => $fboardurl) { + $i++; + $body .= ' ' . $fboardname . ''; + + // only put slash in between elements + if ($i != count($config['foreign_boards'])) { + $body .= ' /'; + } + } + + $body .= '] '; + } + if ($config['boardlist_wrap_bracket'] && !preg_match('/\] $/', $body)) $body = '[' . $body . ']'; diff --git a/inc/instance-config.php b/inc/instance-config.php index 27fc3bab..4489862c 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -12,50 +12,55 @@ * Front page configurations. */ - $config['boards'] = array( - array('leftypol', - 'b', - 'hobby', - 'tech', - 'edu', - 'games', - 'anime' - ) , - array('meta') - ); - // Board categories. Only used in the "Categories" theme. - $config['categories'] = array( - 'Leftypol' => array('leftypol', - 'b', - 'hobby', - 'tech', - 'edu', - 'games', - 'anime' - ), - 'Meta' => array('meta') - ); - // Optional for the Categories theme. This is an array of name => (title, url) groups for categories - // with non-board links. - $config['custom_categories'] = array( - 'Our Friends' => array( - 'GET' => 'https://getchan.net/GET/', - 'ref' => 'https://getchan.net/ref/' - ), - 'Links' => array( - 'New Multitude' => 'https://newmultitude.org/', - 'Booru image repository' => 'https://lefty.booru.org/', - 'Leftypedia' => 'https://leftypedia.org/', - 'Official chat room' => 'https://app.element.io/#/room/!RQxdjfGouwsFHwUzwL:matrix.org', - 'Rules' => 'rules.html' - ), - 'Learning resources and blogs' => array( - 'Michael Roberts\' blog' => 'https://thenextrecession.wordpress.com/', - 'A Critique Of Crisis Theory blog' => 'https://critiqueofcrisistheory.wordpress.com/', - 'Leftypedia' => 'https://leftypedia.org/', - 'Marxis Internet Archive' => 'https://www.marxists.org/' - ), - ); +$config['boards'] = array( + array('leftypol', + 'b', + 'hobby', + 'tech', + 'edu', + 'games', + 'anime' + ) , + array('meta') +); +$config['foreign_boards'] = array( + 'GET' => 'https://getchan.net/GET/', + 'ref' => 'https://getchan.net/ref/' +); +// Board categories. Only used in the "Categories" theme. +$config['categories'] = array( + 'Leftypol' => array('leftypol', + 'b', + 'hobby', + 'tech', + 'edu', + 'games', + 'anime' + ), + 'Meta' => array('meta') +); + +// Optional for the Categories theme. This is an array of name => (title, url) groups for categories +// with non-board links. +$config['custom_categories'] = array( + 'Our Friends' => array( + 'GET' => 'https://getchan.net/GET/', + 'ref' => 'https://getchan.net/ref/' + ), + 'Links' => array( + 'New Multitude' => 'https://newmultitude.org/', + 'Booru image repository' => 'https://lefty.booru.org/', + 'Leftypedia' => 'https://leftypedia.org/', + 'Official chat room' => 'https://app.element.io/#/room/!RQxdjfGouwsFHwUzwL:matrix.org', + 'Rules' => 'rules.html' + ), + 'Learning resources and blogs' => array( + 'Michael Roberts\' blog' => 'https://thenextrecession.wordpress.com/', + 'A Critique Of Crisis Theory blog' => 'https://critiqueofcrisistheory.wordpress.com/', + 'Leftypedia' => 'https://leftypedia.org/', + 'Marxis Internet Archive' => 'https://www.marxists.org/' + ), +); /* * Database and site wide configurations