From bdf1fcf27b7b79719963b4332447e897265cb84d Mon Sep 17 00:00:00 2001 From: nonmakina Date: Tue, 19 Jan 2021 18:40:53 -0600 Subject: [PATCH] Fixes bug and updates PPH on each post --- templates/themes/categories/news.html | 4 ++-- templates/themes/categories/theme.php | 27 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index 48dcf300..8f96de7f 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -30,8 +30,8 @@ {% trans "Post Statistics" %}

- {% stats.pph %} {% trans "posts in the last hour." %} - {% stats.unique_ip_count %} {% trans "unique posters in the last hour." %} + {{ stats.pph }} {% trans "posts in the last hour." %} + {{ stats.unique_ip_count }} {% trans "unique posters in the last hour." %}

diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php index d72762b9..4877f88b 100644 --- a/templates/themes/categories/theme.php +++ b/templates/themes/categories/theme.php @@ -14,23 +14,29 @@ class Categories { public static function build($action, $settings) { global $config; - - if ($action == 'all') + + if ($action == 'all' || + $action == 'boards' || + $action == 'news' || + $action == 'post' || + $action == 'post-thread' || + $action == 'post-delete'){ file_write($config['dir']['home'] . $settings['file_main'], Categories::homepage($settings)); - - if ($action == 'all' || $action == 'boards') - file_write($config['dir']['home'] . $settings['file_sidebar'], Categories::sidebar($settings)); - - if ($action == 'all' || $action == 'news') file_write($config['dir']['home'] . $settings['file_news'], Categories::news($settings)); + } + + if ($action == 'all'){ + file_write($config['dir']['home'] . $settings['file_sidebar'], Categories::sidebar($settings)); + } } + // Build homepage public static function homepage($settings) { global $config; $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC") or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); - $stats = Categories::getPostStatistics($settings); + $stats = Categories::getPostStatistics($settings); return Element( 'themes/categories/frames.html', Array( @@ -38,7 +44,7 @@ 'settings' => $settings, 'categories' => Categories::getCategories($config), 'news' => $news, - 'stats' => $stats, + 'stats' => $stats, 'boardlist' => createBoardlist(false) ) @@ -51,11 +57,12 @@ $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC") or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); - + $stats = Categories::getPostStatistics($settings); return Element('themes/categories/news.html', Array( 'settings' => $settings, 'config' => $config, 'news' => $news, + 'stats' => $stats, 'boardlist' => createBoardlist(false) )); }