From 6fcd4f477911cfb3eb0fa719dd5d19c8d2b16c47 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 13 Mar 2024 13:07:39 +0100 Subject: [PATCH 1/2] Add overboard catalog support. This is an horrenouds hack. Pray to god we manage to refactor it away. See #94 --- inc/mod/pages.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index b39c79ae..3d168bcd 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -766,8 +766,22 @@ function mod_view_catalog($boardName) { if (openBoard($boardName)) { echo $catalog->build($boardName, true); + } + // What follows if horrendous. I am ashamed of myself. See https://git.leftypol.org/leftypol/leftypol/issues/94 + elseif ($boardName === 'overboard' || $boardName === 'sfw' || $boardName === 'alt') { + require "templates/themes/overboards/overboards.php"; + + $settings = array_merge($settings, themeSettings('catalog')); + + foreach ($overboards_config as &$overboard) { + if ($overboard['uri'] === $boardName) { + $included_boards = array_diff(listBoards(true), $overboard['exclude']); + echo $catalog->buildOverboard($overboard['uri'], $settings, $included_boards, true); + break; + } + } } else { - error("The overboard(s) mod catalog hasn't been implemented yet"); + error("Unknown board"); } } From 91e41aa522668bb0fb79208bad44233f27db90ae Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 13 Mar 2024 13:35:48 +0100 Subject: [PATCH 2/2] Refactor overboard catalog support to be slightly less bad --- inc/mod/pages.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 3d168bcd..6b56b3d2 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -768,20 +768,17 @@ function mod_view_catalog($boardName) { echo $catalog->build($boardName, true); } // What follows if horrendous. I am ashamed of myself. See https://git.leftypol.org/leftypol/leftypol/issues/94 - elseif ($boardName === 'overboard' || $boardName === 'sfw' || $boardName === 'alt') { + else { require "templates/themes/overboards/overboards.php"; - - $settings = array_merge($settings, themeSettings('catalog')); - foreach ($overboards_config as &$overboard) { if ($overboard['uri'] === $boardName) { + $settings = array_merge($settings, themeSettings('catalog')); + $included_boards = array_diff(listBoards(true), $overboard['exclude']); echo $catalog->buildOverboard($overboard['uri'], $settings, $included_boards, true); break; } } - } else { - error("Unknown board"); } }