mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-06-16 01:34:31 +02:00
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/
This commit is contained in:
parent
f3efa41baf
commit
05a1509358
@ -66,15 +66,24 @@ if (!empty($_POST)) {
|
|||||||
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
|
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
|
||||||
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
|
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
|
||||||
// If changelog exist
|
// If changelog exist
|
||||||
|
$updatechangelog = false;
|
||||||
if ($changelog !== false) {
|
if ($changelog !== false) {
|
||||||
// Update it
|
// Update it
|
||||||
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
|
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
|
||||||
echo "<h2>Changelog message updated!</h2>";
|
echo "<h2>Changelog message updated!</h2>";
|
||||||
|
$updatechangelog = true;
|
||||||
} else {
|
} else {
|
||||||
// Create it
|
// Create it
|
||||||
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
|
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
|
||||||
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
|
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
|
||||||
echo "<h2>Changelog message created!</h2>";
|
echo "<h2>Changelog message created!</h2>";
|
||||||
|
$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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ if (user_logged_in()) {
|
|||||||
<h1>Changelog</h1>
|
<h1>Changelog</h1>
|
||||||
<?php
|
<?php
|
||||||
$cache = new Cache('engine/cache/changelog');
|
$cache = new Cache('engine/cache/changelog');
|
||||||
if ($cache->hasExpired() || $updateCache === true) {
|
if ($updateCache === true) {
|
||||||
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
||||||
|
|
||||||
$cache->setContent($changelogs);
|
$cache->setContent($changelogs);
|
||||||
@ -64,7 +64,7 @@ if ($cache->hasExpired() || $updateCache === true) {
|
|||||||
}
|
}
|
||||||
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
?>
|
?>
|
||||||
<table>
|
<table id="changelogTable">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<td>Changelogs</td>
|
<td>Changelogs</td>
|
||||||
<?php
|
<?php
|
||||||
|
@ -196,6 +196,8 @@
|
|||||||
// -------------- \\
|
// -------------- \\
|
||||||
// WEBSITE STUFF \\
|
// WEBSITE STUFF \\
|
||||||
// -------------- \\
|
// -------------- \\
|
||||||
|
// Enable or disable changelog ticker in news page.
|
||||||
|
$config['UseChangelogTicker'] = true;
|
||||||
// Highscore configuration
|
// Highscore configuration
|
||||||
$config['highscore'] = array(
|
$config['highscore'] = array(
|
||||||
'rows' => 100,
|
'rows' => 100,
|
||||||
|
28
index.php
28
index.php
@ -1,6 +1,34 @@
|
|||||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||||
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
||||||
else {
|
else {
|
||||||
|
if ($config['UseChangelogTicker']) {
|
||||||
|
//////////////////////
|
||||||
|
// Changelog ticker //
|
||||||
|
// Load from cache
|
||||||
|
$changelogCache = new Cache('engine/cache/changelog');
|
||||||
|
$changelogs = $changelogCache->load();
|
||||||
|
|
||||||
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
|
?>
|
||||||
|
<table id="changelogTable">
|
||||||
|
<tr class="yellow">
|
||||||
|
<td colspan="2">Latest Changelog Updates (<a href="changelog.php">Click here to see full changelog</a>)</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
for ($i = 0; $i < count($changelogs) && $i < 5; $i++) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo getClock($changelogs[$i]['time'], true, true); ?></td>
|
||||||
|
<td><?php echo $changelogs[$i]['text']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
} else echo "No changelogs submitted.";
|
||||||
|
}
|
||||||
|
|
||||||
$cache = new Cache('engine/cache/news');
|
$cache = new Cache('engine/cache/news');
|
||||||
if ($cache->hasExpired()) {
|
if ($cache->hasExpired()) {
|
||||||
$news = fetchAllNews();
|
$news = fetchAllNews();
|
||||||
|
@ -607,3 +607,7 @@ hr {
|
|||||||
.updateTable tr td input {
|
.updateTable tr td input {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#changelogTable {
|
||||||
|
width: 735px;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user