Revert "Add SFW overboard theme"

This commit is contained in:
towards-a-new-leftypol 2021-06-20 13:05:45 -04:00
parent 53f82b295d
commit b11487a8a0
8 changed files with 23 additions and 478 deletions

View file

@ -84,11 +84,18 @@
'comment' => 'Check this if you wish to show a nice tooltip with info about the thread on mouse over.'
);
$theme['config'][] = Array(
'title' => 'Build overboard catalogs',
'title' => 'Build overboard catalog',
'name' => 'has_overboard',
'type' => 'checkbox',
'default' => false,
'comment' => 'Check this if you wish to create a catalog for the overboard. Requires Overboards theme.'
'comment' => 'Check this if you wish to create a catalog for the overboard.'
);
$theme['config'][] = Array(
'title' => 'Overboard location (default \'overboard\')',
'name' => 'overboard_location',
'type' => 'text',
'default' => 'overboard',
'comment' => 'Fill in the location of the overboard directory. Default is \'overboard\' which corresponds to ./overboard'
);
$theme['config'][] = Array(
'title' => 'Max posts in catalog overboard',

View file

@ -9,11 +9,6 @@
$b = new Catalog($settings);
$boards = explode(' ', $settings['boards']);
if (isset($settings['has_overboard']) && $settings['has_overboard']) {
// Include overboard settings so that we can find them all and process exclusions
require "templates/themes/overboards/overboards.php";
}
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
@ -33,16 +28,14 @@
}
}
if(isset($settings['has_overboard']) && $settings['has_overboard']) {
foreach ($overboards_config as &$overboard) {
$included_boards = array_diff(listBoards(true), $overboard['exclude']);
$action = generation_strategy("sb_catalog", array($overboard));
if ($action == 'delete') {
file_unlink($config['dir']['home'] . $overboard . '/catalog.html');
file_unlink($config['dir']['home'] . $overboard . '/index.rss');
}
elseif ($action == 'rebuild') {
$b->buildOverboardCatalog($overboard['uri'], $settings, $included_boards);
}
$board = $settings['overboard_location'];
$action = generation_strategy("sb_catalog", array($board));
if ($action == 'delete') {
file_unlink($config['dir']['home'] . $board . '/catalog.html');
file_unlink($config['dir']['home'] . $board . '/index.rss');
}
elseif ($action == 'rebuild') {
$b->buildOverboardCatalog($settings, $boards);
}
}
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete')
@ -58,12 +51,7 @@
print_err("catalog_build calling Catalog.build 2");
$b->build($settings, $board);
if(isset($settings['has_overboard']) && $settings['has_overboard']) {
foreach ($overboards_config as &$overboard) {
if ($overboard['uri'] == $board) {
$included_boards = array_diff(listBoards(true), $overboard['exclude']);
$b->buildOverboardCatalog($board, $settings, $included_boards);
}
}
$b->buildOverboardCatalog($settings, $boards);
}
}
}
@ -309,7 +297,7 @@
$recent_posts = $this->generateRecentPosts($threads);
$this->saveForBoard($randSettings['uri'], $recent_posts,
$config['root'] . $randSettings['uri'], true);
$config['root'] . $randSettings['uri']);
}
/**
@ -359,8 +347,10 @@
/**
* Build and save the HTML of the catalog for the overboard
*/
public function buildOverboardCatalog($board_name, $settings, $boards) {
public function buildOverboardCatalog($settings, $boards) {
global $config;
$board_name = $settings['overboard_location'];
if (array_key_exists($board_name, $this->threadsCache)) {
$threads = $this->threadsCache[$board_name];
@ -382,7 +372,7 @@
// Generate data for the template
$recent_posts = $this->generateRecentPosts($threads);
$this->saveForBoard($board_name, $recent_posts, '/' . $board_name, true);
$this->saveForBoard($board_name, $recent_posts, '/' . $settings['overboard_location'], true);
// Build the overboard JSON outputs
if ($config['api']['enabled']) {