Browse Source

Add overboard support to mod catalog

discomrade 1 year ago
parent
commit
24e069182f
  1. 14
      inc/mod/pages.php
  2. 20
      templates/themes/catalog/theme.php

14
inc/mod/pages.php

@ -759,7 +759,19 @@ function mod_view_catalog($boardName) {
$settings['title'] = 'Catalog';
$settings['use_tooltipster'] = true;
$catalog = new Catalog($settings);
echo $catalog->build($boardName, $mod);
$query = prepare(sprintf('SELECT * FROM ``theme_settings`` WHERE `name` = "uri" AND `value` = :uri', $board));
$query->bindValue(':uri', $boardName);
$query->execute() or error(db_error($query));
if ($theme = $query->fetch(PDO::FETCH_ASSOC)){
if ($theme['theme'] == "rand")
echo $catalog->buildRand($mod);
if ($theme['theme'] == "ukko")
echo $catalog->buildUkko($mod);
} else {
echo $catalog->build($boardName, $mod);
}
}
function mod_view_board($boardName, $page_no = 1) {

20
templates/themes/catalog/theme.php

@ -67,7 +67,7 @@
/**
* Build and save the HTML of the catalog for the Ukko theme
*/
public function buildUkko() {
public function buildUkko($mod = false) {
global $board, $config;
$ukkoSettings = themeSettings('ukko');
@ -97,7 +97,7 @@
return strcmp($b['bump'], $a['bump']);
});
// Generate data for the template
$recent_posts = $this->generateRecentPosts($threads);
$recent_posts = $this->generateRecentPosts($threads, $mod);
// Generate board data for building
$board_original = $board;
@ -106,16 +106,18 @@
$board['title'] = $ukkoSettings['title'];
$board['subtitle'] = $ukkoSettings['subtitle'];
$this->saveForBoard($ukkoSettings['uri'], $recent_posts,
$config['root'] . $ukkoSettings['uri']);
$ret = $this->saveForBoard($ukkoSettings['uri'], $recent_posts,
$config['root'] . $ukkoSettings['uri'], $mod);
$board = $board_original;
return $ret;
}
/**
* Build and save the HTML of the catalog for the Rand theme
*/
public function buildRand() {
public function buildRand($mod = false) {
global $board, $config;
$randSettings = themeSettings('rand');
@ -143,7 +145,7 @@
// Randomize order
shuffle($threads);
// Generate data for the template
$recent_posts = $this->generateRecentPosts($threads);
$recent_posts = $this->generateRecentPosts($threads, $mod);
// Generate board data for building
$board_original = $board;
@ -152,10 +154,12 @@
$board['title'] = $randSettings['title'];
$board['subtitle'] = $randSettings['subtitle'];
$this->saveForBoard($randSettings['uri'], $recent_posts,
$config['root'] . $randSettings['uri']);
$ret = $this->saveForBoard($randSettings['uri'], $recent_posts,
$config['root'] . $randSettings['uri'], $mod);
$board = $board_original;
return $ret;
}
/**

Loading…
Cancel
Save