From 85447140574a74b6fb27beb7939ef1f84ca18691 Mon Sep 17 00:00:00 2001 From: PupperWoff Date: Tue, 6 Jun 2017 17:39:29 +0200 Subject: [PATCH] Update and BugFix - Added Links to Archive and Featured Archive and Reload to Thread Pages and Catalog - Added Announcements to Catalog - And Small Bugfix to Announcements where link to [Show all] was wrong --- inc/announcements.php | 11 ++++++++++- inc/archive.php | 1 + inc/config.php | 2 ++ inc/mod/pages.php | 1 + templates/index.html | 20 ++++++++++++++++---- templates/mod/archive_list.html | 6 ++++++ templates/themes/catalog/catalog.html | 8 ++++++++ templates/thread.html | 8 ++++---- 8 files changed, 48 insertions(+), 9 deletions(-) diff --git a/inc/announcements.php b/inc/announcements.php index 092d35de..1c3eb8ec 100644 --- a/inc/announcements.php +++ b/inc/announcements.php @@ -78,7 +78,7 @@ class Announcements { static public function buildAnnouncementPages() { global $config; - // Generate page for full list of announcements + // Generate pages for full list of announcements if($config['announcements']['page']) { // Generate JSON file for full list of announcements @@ -105,12 +105,21 @@ class Announcements { 'announcements' => $announcements, 'mod' => false, 'token_json' => false, + 'uri_json' => $config['root'] . $config['announcements']['file_json'], )) )); file_write($config['dir']['home'] . $config['announcements']['page_html'], $announcement_page); } } + + + static public function stream_json($out = false, $filter_staff = false, $date_format = "%m/%d/%Y", $count = false) { + $query = query("SELECT ``announcements``.*, `username` FROM ``announcements`` + LEFT JOIN ``mods`` ON ``mods``.`id` = `creator` + ORDER BY `date` DESC" . (($count === false)?"":" LIMIT " . (int)$count)) or error(db_error($query)); + $announcements = $query->fetchAll(PDO::FETCH_ASSOC); + } /* Might be used later for mobile API static public function stream_json($out = false, $filter_staff = false, $date_format, $count = false) { $query = query("SELECT ``announcements``.*, `username` FROM ``announcements`` diff --git a/inc/archive.php b/inc/archive.php index bf861485..614f4c1c 100644 --- a/inc/archive.php +++ b/inc/archive.php @@ -250,6 +250,7 @@ class Archive { 'body' => Element("mod/archive_list.html", array( 'config' => $config, 'thread_count' => $query->rowCount(), + 'board' => $board, 'archive' => $archive )) )); diff --git a/inc/config.php b/inc/config.php index 3c592ac1..533c0702 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1310,6 +1310,8 @@ $config['archive']['threads'] = true; // Indicate if it is possible to mark threads as featured (stored forever) $config['feature']['threads'] = true; + // Indicate if link to featured archive should be shown on post and thread page + $config['feature']['link_post_page'] = false; // Days to keep archived threads before deletion (if set to false all archived threads are kept forever) $config['archive']['lifetime'] = 3; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 98ab9af9..67f20b1e 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -3622,6 +3622,7 @@ function mod_view_archive($boardName) { mod_page(sprintf(_('Archived') . ' %s: ' . $config['board_abbreviation'], _('threads'), $board['uri']), 'mod/archive_list.html', array( 'archive' => $archive, 'thread_count' => $query->rowCount(), + 'board' => $board, 'token' => make_secure_link_token($board['uri']. '/archive/') )); } diff --git a/templates/index.html b/templates/index.html index f169b864..be52baf5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -62,7 +62,13 @@ [{% trans %}Go to bottom{% endtrans %}] {% if config.catalog_link %} - [{% trans %}Catalog{% endtrans %}] + [{% trans %}Catalog{% endtrans %}] + {% endif %} + {% if config.archive.threads %} + [{% trans %}Archive{% endtrans %}] + {% endif %} + {% if config.feature.threads and config.feature.link_post_page %} + [{% trans %}Featured{% endtrans %}] {% endif %} {% if config.board_search %} @@ -76,17 +82,23 @@ {% endif %} +
{% if mod %}{% endif %} -
{{ body }}
[{% trans %}Go to top{% endtrans %}] {% if config.catalog_link %} - [{% trans %}Catalog{% endtrans %}] - {% endif %} + [{% trans %}Catalog{% endtrans %}] + {% endif %} + {% if config.archive.threads %} + [{% trans %}Archive{% endtrans %}] + {% endif %} + {% if config.feature.threads and config.feature.link_post_page %} + [{% trans %}Featured{% endtrans %}] + {% endif %}
{% include 'report_delete.html' %} diff --git a/templates/mod/archive_list.html b/templates/mod/archive_list.html index 65957f68..4a0612e1 100644 --- a/templates/mod/archive_list.html +++ b/templates/mod/archive_list.html @@ -1,5 +1,11 @@ + +{% if config.feature.threads %} +

+ [{% trans %}Featured Thread Archive{% endtrans %}] +

+{% endif %}

{% trans 'Displaying' %} {{ thread_count }} {% trans 'expired threads' %}{% if config.archive.lifetime %} {% trans 'from the past' %} {{ config.archive.lifetime }} {% trans 'days' %}{% endif %}

diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 80b5a393..d187df47 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -19,6 +19,8 @@ {% include 'post_form.html' %} + {% if config.announcements.show %}
{% endif %} + {% trans 'Sort by' %}: + +   + [{% trans %}Reload{% endtrans %}] + {% if config.archive.threads %}[{% trans %}Archive{% endtrans %}]{% endif %} + {% if config.feature.threads and config.feature.link_post_page %}[{% trans %}Featured{% endtrans %}]{% endif %} +
{% for post in recent_posts %} diff --git a/templates/thread.html b/templates/thread.html index 21b30436..838430e0 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -58,21 +58,21 @@ [{% trans %}Go to bottom{% endtrans %}] {% if config.catalog_link %} - [{% trans %}Catalog{% endtrans %}] + [{% trans %}Catalog{% endtrans %}] {% endif %} [{% trans %}Return{% endtrans %}]
+
{% if mod %}{% endif %} -
{{ body }}