diff --git a/_sakura/changelog.json b/_sakura/changelog.json index c389319..762e263 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -27,7 +27,8 @@ "20150504", "20150504.1", "20150505", - "20150505.1" + "20150505.1", + "20150506" ] @@ -946,6 +947,23 @@ "change": "Export new SQL structure (and example data)." } + ], + + "20150506": [ + + { + "type": "UPD", + "change": "Add some content retrieval functions for the forum." + }, + { + "type": "ADD", + "change": "Added post count to the users table structure." + }, + { + "type": "UPD", + "change": "Moved panel on the right site of the index to its own template file." + } + ] } diff --git a/_sakura/components/Forum.php b/_sakura/components/Forum.php index 66422f4..2e73566 100644 --- a/_sakura/components/Forum.php +++ b/_sakura/components/Forum.php @@ -7,6 +7,53 @@ namespace Sakura; class Forum { - + // Getting the board list + public static function getBoardList() { + + // Get the content from the database + $forums = Database::fetch('forums'); + + // Create return array + $return = [ + 0 => [ + 'data' => [ + 'forum_id' => 0, + 'forum_name' => 'Forum', + 'forum_desc' => '', + 'forum_link' => '', + 'forum_category' => 0, + 'forum_type' => 1, + 'forum_posts' => 0, + 'forum_topics' => 0, + 'forum_last_post_id' => 0, + 'forum_last_poster_id' => 0 + ], + 'forums' => [] + ] + ]; + + // Resort the forums + foreach($forums as $forum) { + + // If the forum type is a category create a new one + if($forum['forum_type'] == 1) + $return[$forum['forum_id']]['data'] = $forum; + else { + + // For link and reg. forum add it to the category + $return[$forum['forum_category']]['forums'][$forum['forum_id']] = $forum; + + // Add last poster data and the details about the post as well + $return[$forum['forum_category']]['forums'][$forum['forum_id']]['last_poster_data'] = ($_LAST_POSTER = Users::getUser($forum['forum_last_poster_id'])); + $return[$forum['forum_category']]['forums'][$forum['forum_id']]['last_poster_rank'] = Users::getRank($_LAST_POSTER['rank_main']); + + } + + } + + // Return the resorted data + return $return; + + } } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index 8a3f6bd..c69343f 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -32,6 +32,7 @@ class Users { 'lastdate' => 0, 'lastunamechange' => 0, 'birthday' => '', + 'posts' => 0, 'country' => 'EU', 'profile_data' => '[]' ]; diff --git a/_sakura/config/config.example.php b/_sakura/config/config.example.php index 6c79db5..6101736 100644 --- a/_sakura/config/config.example.php +++ b/_sakura/config/config.example.php @@ -20,6 +20,7 @@ $sakuraConf['urls']['api'] = 'api.flashii.net'; // API url $sakuraConf['urls']['content'] = 'cdn.flashii.net'; // Content directory url $sakuraConf['urls']['chat'] = 'chat.flashii.net'; // Chat url $sakuraConf['urls']['manage'] = 'manage.flashii.net'; // Moderator panel url +$sakuraConf['urls']['forum'] = 'forum.flashii.net'; // Forum url // Errata $sakuraConf['etc'] = array(); diff --git a/_sakura/sakura.php b/_sakura/sakura.php index b41c17e..2a3b0c0 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150505.1'); +define('SAKURA_VERSION', '20150506'); define('SAKURA_VLABEL', 'Heliotrope'); define('SAKURA_VTYPE', 'Development'); define('SAKURA_COLOUR', '#DF73FF'); diff --git a/_sakura/templates/yuuno/elements/indexPanel.tpl b/_sakura/templates/yuuno/elements/indexPanel.tpl new file mode 100644 index 0000000..a4c6cef --- /dev/null +++ b/_sakura/templates/yuuno/elements/indexPanel.tpl @@ -0,0 +1,34 @@ +{% if user.checklogin %} +
{{ category.data.forum_name }} | +|||||
+ + | +
+
+ {{ forum.forum_desc }}
+ |
+ {% if forum.forum_type != 2 %}
+
+ {{ forum.forum_topics }}
+ {{ forum.forum_posts }}
+ |
+
+
+ {% if forum.forum_last_post_id %}
+ Last post in Thread with an obnoxiously long fucking title
+ 12 years ago by {{ forum.last_poster_data.username }} + {% else %} + There are no posts in this forum. + {% endif %} + |
+ {% endif %}
+