From 05a150935885a8c88ce7ab348febb4854c98803e Mon Sep 17 00:00:00 2001 From: Stefan Brannfjell Date: Mon, 5 May 2014 23:12:37 +0200 Subject: [PATCH] Preview: http://4.ii.gl/4VnAws.png Added changelog ticker system in front page. Optional enable/disable it in config.php Only refreshes the cache when any changes are being done to it. This looks way more practical than a stupid news ticker. Inspiration from: http://nelvara.com/ --- admin_reports.php | 9 +++++++++ changelog.php | 4 ++-- config.php | 2 ++ index.php | 28 ++++++++++++++++++++++++++++ layout/css/style.css | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/admin_reports.php b/admin_reports.php index 778425b..1f735e7 100644 --- a/admin_reports.php +++ b/admin_reports.php @@ -66,15 +66,24 @@ if (!empty($_POST)) { // Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`) $changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;"); // If changelog exist + $updatechangelog = false; if ($changelog !== false) { // Update it mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;"); echo "

Changelog message updated!

"; + $updatechangelog = true; } else { // Create it mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`) VALUES ('$changelogText', '$time', '$changelogReportId', '$status');"); echo "

Changelog message created!

"; + $updatechangelog = true; + } + if ($updatechangelog) { + // Cache changelog + $cache = new Cache('engine/cache/changelog'); + $cache->setContent(mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;")); + $cache->save(); } } diff --git a/changelog.php b/changelog.php index bc628db..629a17c 100644 --- a/changelog.php +++ b/changelog.php @@ -54,7 +54,7 @@ if (user_logged_in()) {

Changelog

hasExpired() || $updateCache === true) { +if ($updateCache === true) { $changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;"); $cache->setContent($changelogs); @@ -64,7 +64,7 @@ if ($cache->hasExpired() || $updateCache === true) { } if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) { ?> - +
100, diff --git a/index.php b/index.php index 973a05e..94848c5 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,34 @@ load(); + + if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) { + ?> +
Changelogs
+ + + + + + + + + +
Latest Changelog Updates (Click here to see full changelog)
+ hasExpired()) { $news = fetchAllNews(); diff --git a/layout/css/style.css b/layout/css/style.css index afe0a68..ba7b020 100644 --- a/layout/css/style.css +++ b/layout/css/style.css @@ -606,4 +606,8 @@ hr { } .updateTable tr td input { width: 500px; +} + +#changelogTable { + width: 735px; } \ No newline at end of file