diff --git a/images/changelog/unknown.png b/images/changelog/unknown.png
new file mode 100644
index 00000000..9cf7605f
Binary files /dev/null and b/images/changelog/unknown.png differ
diff --git a/index.php b/index.php
index 124d9cf9..fee0c8e7 100644
--- a/index.php
+++ b/index.php
@@ -93,6 +93,7 @@ else {
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
+ '/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
diff --git a/install/includes/schema.sql b/install/includes/schema.sql
index 9b0bd744..d45965b0 100644
--- a/install/includes/schema.sql
+++ b/install/includes/schema.sql
@@ -155,6 +155,7 @@ CREATE TABLE `myaac_menu`
/* MENU_CATEGORY_NEWS kathrine */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
+INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Changelog', 'changelog', 1, 2);
/* MENU_CATEGORY_ACCOUNT kathrine */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
diff --git a/system/migrations/17.php b/system/migrations/17.php
index 5d5b0f8c..751df6f6 100644
--- a/system/migrations/17.php
+++ b/system/migrations/17.php
@@ -18,6 +18,7 @@ CREATE TABLE `myaac_menu`
/* MENU_CATEGORY_NEWS kathrine */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
+INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Changelog', 'changelog', 1, 2);
/* MENU_CATEGORY_ACCOUNT kathrine */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
diff --git a/system/pages/changelog.php b/system/pages/changelog.php
index 04620f81..7b1a5c6c 100644
--- a/system/pages/changelog.php
+++ b/system/pages/changelog.php
@@ -15,66 +15,32 @@ $id = isset($_GET['id']) ? $_GET['id'] : 0;
$limit = 30;
$offset = $_page * $limit;
$next_page = false;
-?>
-
-
-
- Type |
- Where |
- Date |
- Description |
-
-query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` WHERE `hidden` = 0 ORDER BY `id` DESC LIMIT ' . ($limit + 1) . ' OFFSET ' . $offset)->fetchAll();
-$changelogs = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'changelog') . ' ORDER BY ' . $db->fieldName('id') . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset);
-if(!$changelogs->rowCount())
+$i = 0;
+foreach($changelogs as $key => &$log)
{
-?>
-
- There are no change logs for the moment. |
-
-
-
-
-
- |
-
-
- |
- |
- |
-
-= $limit)
- $next_page = true;
+ if($i < $limit) {
+ $log['type'] = getChangelogType($log['type']);
+ $log['where'] = getChangelogWhere($log['where']);
+ }
+ else {
+ unset($changelogs[$key]);
}
-?>
-
-= $limit)
+ $next_page = true;
+
+ $i++;
}
-?>
-
-render('changelog.html.twig', array(
+ 'changelogs' => $changelogs,
+ 'page' => $_page,
+ 'next_page' => $next_page,
+));
+
function getChangelogType($v)
{
switch($v) {
@@ -88,7 +54,7 @@ function getChangelogType($v)
return 'fixed';
}
- return 'Unknown type';
+ return 'unknown';
}
function getChangelogWhere($v)
@@ -100,6 +66,6 @@ function getChangelogWhere($v)
return 'website';
}
- return 'Unknown where';
+ return 'unknown';
}
?>
diff --git a/system/templates/changelog.html.twig b/system/templates/changelog.html.twig
new file mode 100644
index 00000000..c9e266b8
--- /dev/null
+++ b/system/templates/changelog.html.twig
@@ -0,0 +1,38 @@
+
+
+
+ Type |
+ Where |
+ Date |
+ Description |
+
+ {% if changelogs|length > 0%}
+ {% set i = 0 %}
+ {% for log in changelogs %}
+
+
+
+ |
+
+
+ |
+ {{ log.date|date("j.m.Y") }} |
+ {{ log.body|raw }} |
+
+ {% set i = i + 1 %}
+ {% endfor %}
+ {% else %}
+
+ There are no change logs for the moment. |
+
+ {% endif %}
+
+
+
\ No newline at end of file