From 34cf8a18038c7d634354aeeeefa7f65fdd36cbb6 Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 6 May 2015 13:42:02 +0000 Subject: [PATCH] last windows 8 commit for a while ;_; --- _sakura/changelog.json | 20 +++++- _sakura/components/Forum.php | 49 +++++++++++++- _sakura/components/Users.php | 1 + _sakura/config/config.example.php | 1 + _sakura/sakura.php | 2 +- .../templates/yuuno/elements/indexPanel.tpl | 34 ++++++++++ _sakura/templates/yuuno/forum/index.tpl | 48 +++++++++++++- _sakura/templates/yuuno/global/header.tpl | 2 +- _sakura/templates/yuuno/main/index.tpl | 38 +---------- _sakura/templates/yuuno/main/profile.tpl | 3 +- content/data/yuuno/css/yuuno.css | 64 +++++++++++++++++++ forum/index.php | 12 +++- forum/posting.php | 10 +++ forum/viewforum.php | 10 +++ forum/viewtopic.php | 10 +++ main/index.php | 4 +- 16 files changed, 265 insertions(+), 43 deletions(-) create mode 100644 _sakura/templates/yuuno/elements/indexPanel.tpl create mode 100644 forum/posting.php create mode 100644 forum/viewforum.php create mode 100644 forum/viewtopic.php 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 %} +
Hi, {{ user.data.username }}!
+ + +
+{% else %} + {% if sakura.lockauth %} +
Whoops!
+ You caught the site at the wrong moment! Right now registration and logging in is disabled for unspecified reasons. Sorry for the inconvenience but please try again later! + {% else %} +
Welcome!
+ Welcome to Flashii! This is a site for a bunch of friends to hang out, nothing special. Anyone is pretty much welcome to register so why not have a go? + Register! + Login + {% endif %} +{% endif %} +
Stats
+We have {{ stats.userCount }}, +{{ stats.newestUser.username }} is the newest user, +it has been {{ stats.lastRegDate }} since the last user registered, +there's {{ stats.chatOnline }} in chat right now and the forum has {{ stats.topicCount }} and {{ stats.postCount }}. +
Online Users
+{% if stats.onlineUsers %} + All active users in the past 5 minutes:
+ {% for amount,onlineUser in stats.onlineUsers %} + {{ onlineUser.username }}{% if amount != (stats.onlineUsers|length - 1) %}, {% endif %} + {% endfor %} +{% else %} + There were no online users in the past 5 minutes. +{% endif %} \ No newline at end of file diff --git a/_sakura/templates/yuuno/forum/index.tpl b/_sakura/templates/yuuno/forum/index.tpl index 25b9863..7705889 100644 --- a/_sakura/templates/yuuno/forum/index.tpl +++ b/_sakura/templates/yuuno/forum/index.tpl @@ -1,3 +1,49 @@ {% include 'global/header.tpl' %} - +
+
+ {% include 'elements/indexPanel.tpl' %} +
+
+
Forums
+ + + {% for category in page.boards %} + {% if category.forums|length %} + + + + {% for forum in category.forums %} + + + + {% if forum.forum_type != 2 %} + + + {% endif %} + + {% endfor %} + {% endif %} + {% endfor %} + +
{{ category.data.forum_name }}
+
+
+ +
{{ forum.forum_desc }}
+
+
{{ 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 %} +
+
+
+
+
+ {% include 'global/footer.tpl' %} diff --git a/_sakura/templates/yuuno/global/header.tpl b/_sakura/templates/yuuno/global/header.tpl index 70fce21..8e3f90c 100644 --- a/_sakura/templates/yuuno/global/header.tpl +++ b/_sakura/templates/yuuno/global/header.tpl @@ -123,7 +123,7 @@