public function homepage($settings, $board_name) {
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Catalog {
public function build($settings, $board_name) {
global $config, $board;
global $config, $board;
openBoard($board_name);
$recent_images = array();
$recent_images = array();
$recent_posts = array();
$recent_posts = array();
$stats = array();
$stats = array();
@ -39,16 +40,13 @@
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());