diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-07-18 12:06:26 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-07-18 12:06:26 -0400 |
| commit | e4bd9a6886af2a812ccc909d8ad957df1bdc5d2b (patch) | |
| tree | 698630de8be70b1bf50fadef701c13109c1d5083 /templates/themes | |
| parent | de4b5b396246ee5c3cb8687cfef3647c844a3b54 (diff) | |
Themes edit: Split "post" into two seperate actions: "post" (replies) and "post-thread". And add a $board variable.
Diffstat (limited to 'templates/themes')
| -rw-r--r-- | templates/themes/basic/theme.php | 2 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 50 | ||||
| -rw-r--r-- | templates/themes/categories/theme.php | 2 | ||||
| -rw-r--r-- | templates/themes/frameset/theme.php | 2 | ||||
| -rw-r--r-- | templates/themes/recent/theme.php | 5 | ||||
| -rw-r--r-- | templates/themes/rrdtool/theme.php | 2 | ||||
| -rw-r--r-- | templates/themes/sitemap/theme.php | 6 |
7 files changed, 35 insertions, 34 deletions
diff --git a/templates/themes/basic/theme.php b/templates/themes/basic/theme.php index 806a331a..7ba0d1e7 100644 --- a/templates/themes/basic/theme.php +++ b/templates/themes/basic/theme.php @@ -1,7 +1,7 @@ <?php require 'info.php'; - function basic_build($action, $settings) { + function basic_build($action, $settings, $board) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 356933ba..e585cf17 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -1,37 +1,38 @@ <?php require 'info.php'; - function catalog_build($action, $settings) { + function catalog_build($action, $settings, $board) { + global $config; + // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) // - boards (board list changed) - // - post (a post has been made) + // - post (a reply has been made) + // - post-thread (a thread has been made) - $b = new Catalog(); - $b->build($action, $settings); - } - - // Wrap functions in a class so they don't interfere with normal Tinyboard operations - class Catalog { - public function build($action, $settings) { - global $config, $_theme; - - if ($action == 'all') { - copy('templates/themes/catalog/catalog.css', $config['dir']['home'] . $settings['css']); - } + $boards = explode(' ', $settings['boards']); + + if ($action == 'all') { + copy('templates/themes/catalog/catalog.css', $config['dir']['home'] . $settings['css']); - $boards = explode(' ', $settings['boards']); foreach ($boards as $board) { - if ($action == 'all' || $action == 'post') - file_write($config['dir']['home'] . $board . '/catalog.html', $this->homepage($settings, $board)); + $b = new Catalog(); + $b->build($settings, $board); } - + } elseif ($action == 'post-thread' && in_array($board, $boards)) { + $b = new Catalog(); + $b->build($settings, $board); } - - 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; + openBoard($board_name); + $recent_images = array(); $recent_posts = 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()); while ($post = $query->fetch()) { - openBoard($post['board']); - $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])); $post['board_name'] = $board['name']; $post['file'] = $config['uri_thumb'] . $post['thumb']; $recent_posts[] = $post; } - - return Element('themes/catalog/catalog.html', Array( + file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', Array( 'settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), @@ -57,8 +55,6 @@ 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'] - )); + ))); } }; - -?> diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php index 11fcbbaf..7d468d0d 100644 --- a/templates/themes/categories/theme.php +++ b/templates/themes/categories/theme.php @@ -1,7 +1,7 @@ <?php require 'info.php'; - function categories_build($action, $settings) { + function categories_build($action, $settings, $board) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) diff --git a/templates/themes/frameset/theme.php b/templates/themes/frameset/theme.php index 015eebaf..5fd9d29e 100644 --- a/templates/themes/frameset/theme.php +++ b/templates/themes/frameset/theme.php @@ -1,7 +1,7 @@ <?php require 'info.php'; - function frameset_build($action, $settings) { + function frameset_build($action, $settings, $board) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index 986fac6a..1ebe58f6 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -1,12 +1,13 @@ <?php require 'info.php'; - function recentposts_build($action, $settings) { + function recentposts_build($action, $settings, $board) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) // - boards (board list changed) // - post (a post has been made) + // - post-thread (a thread has been made) $b = new RecentPosts(); $b->build($action, $settings); @@ -23,7 +24,7 @@ $this->excluded = explode(' ', $settings['exclude']); - if ($action == 'all' || $action == 'post') + if ($action == 'all' || $action == 'post' || $action == 'post-thread') file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings)); } diff --git a/templates/themes/rrdtool/theme.php b/templates/themes/rrdtool/theme.php index eed2ac9a..68fc1850 100644 --- a/templates/themes/rrdtool/theme.php +++ b/templates/themes/rrdtool/theme.php @@ -1,7 +1,7 @@ <?php require 'info.php'; - function rrdtool_build($action, $settings) { + function rrdtool_build($action, $settings, $board) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php index 372d292d..e210316b 100644 --- a/templates/themes/sitemap/theme.php +++ b/templates/themes/sitemap/theme.php @@ -1,7 +1,7 @@ <?php require 'info.php'; - function sitemap_build($action, $settings) { + function sitemap_build($action, $settings, $board) { global $config; // Possible values for $action: @@ -9,6 +9,10 @@ // - news (news has been updated) // - boards (board list changed) // - post (a post has been made) + // - thread (a thread has been made) + + if ($action != 'post' && $action != 'post-thread') + return; $boards = explode(' ', $settings['boards']); |
