last windows 8 commit for a while ;_;

This commit is contained in:
flash 2015-05-06 13:42:02 +00:00
parent 70c3f45228
commit 34cf8a1803
16 changed files with 265 additions and 43 deletions

View file

@ -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."
}
]
}

View file

@ -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;
}
}

View file

@ -32,6 +32,7 @@ class Users {
'lastdate' => 0,
'lastunamechange' => 0,
'birthday' => '',
'posts' => 0,
'country' => 'EU',
'profile_data' => '[]'
];

View file

@ -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();

View file

@ -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');

View file

@ -0,0 +1,34 @@
{% if user.checklogin %}
<div class="head">Hi, {{ user.data.username }}!</div>
<img src="//{{ sakura.urls.main }}/a/{{ user.data.id }}" class="default-avatar-setting homepage-menu-avatar" />
<ul>
<li><a href="//{{ sakura.urls.main }}/settings/profile" class="underline">Edit profile</a></li>
<li><a href="//{{ sakura.urls.main }}/settings/avatar" class="underline">Change avatar</a></li>
<li><a href="//{{ sakura.urls.main }}/settings/sessions" class="underline">View active sessions</a></li>
</ul>
<div class="clear"></div>
{% else %}
{% if sakura.lockauth %}
<div class="head">Whoops!</div>
You caught the site at the wrong moment! Right now registration <i>and</i> logging in is disabled for unspecified reasons. Sorry for the inconvenience but please try again later!
{% else %}
<div class="head">Welcome!</div>
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?
<a class="button registerbutton" href="//{{ sakura.urls.main }}/register">Register!</a>
<a class="button loginbutton" href="//{{ sakura.urls.main }}/login">Login</a>
{% endif %}
{% endif %}
<div class="head">Stats</div>
We have <b>{{ stats.userCount }}</b>,
<b><a href="//{{ sakura.urls.main }}/u/{{ stats.newestUser.id }}" class="default">{{ stats.newestUser.username }}</a></b> is the newest user,
it has been <b>{{ stats.lastRegDate }}</b> since the last user registered,
there's <b>{{ stats.chatOnline }}</b> in chat right now and the forum has <b>{{ stats.topicCount }}</b> and <b>{{ stats.postCount }}</b>.
<div class="head">Online Users</div>
{% if stats.onlineUsers %}
All active users in the past 5 minutes:<br />
{% for amount,onlineUser in stats.onlineUsers %}
<a href="//{{ sakura.urls.main }}/u/{{ onlineUser.id }}" style="font-weight: bold;" class="default">{{ onlineUser.username }}</a>{% if amount != (stats.onlineUsers|length - 1) %}, {% endif %}
{% endfor %}
{% else %}
There were no online users in the past 5 minutes.
{% endif %}

View file

@ -1,3 +1,49 @@
{% include 'global/header.tpl' %}
<div class="content homepage forum">
<div class="content-right content-column">
{% include 'elements/indexPanel.tpl' %}
</div>
<div class="content-left content-column">
<div class="head">Forums</div>
<table class="forumList">
<tbody>
{% for category in page.boards %}
{% if category.forums|length %}
<tr class="forumCategory">
<td class="forumCategoryTitleColumn" colspan="4"><a href="//{{ sakura.urls.forum }}/{{ category.data.forum_id }}/" class="clean">{{ category.data.forum_name }}</a></td>
</tr>
{% for forum in category.forums %}
<tr class="forumForum">
<td class="forumIconColumn">
<div class="forumIcon read fa fa-3x {% if forum.forum_icon %}{{ forum.forum_icon }}{% else %}{% if forum.forum_type %}fa-chevron-circle-right{% else %}fa-comments{% endif %}{% endif %}"></div>
</td>
<td class="forumTitleColumn"{% if forum.forum_type == 2 %} colspan="3"{% endif %}>
<div class="name"><a href="{% if forum.forum_type == 2 %}{{ forum.forum_link }}" target="_blank"{% else %}//{{ sakura.urls.forum }}/{{ forum.forum_id }}/"{% endif %} class="default">{{ forum.forum_name }}</a></div>
<div class="desc">{{ forum.forum_desc }}</div>
</td>
{% if forum.forum_type != 2 %}
<td class="forumCountColumn">
<div class="topics" title="Amount of topics in this forum.">{{ forum.forum_topics }}</div>
<div class="posts" title="Amount of posts in this forum.">{{ forum.forum_posts }}</div>
</td>
<td class="forumLastColumn">
<div>
{% if forum.forum_last_post_id %}
Last post in <a href="//{{ sakura.urls.forum }}/thread/{{ forum.forum_last_post_id }}" class="default">Thread with an obnoxiously long fucking title</a><br />12 years ago by <a href="//{{ sakura.urls.main }}/u/{{ forum.last_poster_data.id }}" class="default" style="color: {% if forum.last_poster_data.name_colour %}{{ forum.last_poster_data.name_colour }}{% else %}{{ forum.last_poster_rank.colour }}{% endif %};">{{ forum.last_poster_data.username }}</a>
{% else %}
There are no posts in this forum.<br />&nbsp;
{% endif %}
</div>
</td>
{% endif %}
</tr>
{% endfor %}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript" src="{{ sakura.resources }}/js/ybabstat.js"></script>
{% include 'global/footer.tpl' %}

View file

@ -123,7 +123,7 @@
<div id="container">
<span id="top"></span>
<div class="header" id="header">
<a class="logo" href="/">{{ sakura.sitename }}</a>
<a class="logo" href="//{{ sakura.urls.main }}/">{{ sakura.sitename }}</a>
<div class="menu">
<div class="menu-nav" id="navMenuSite">
<!-- Navigation menu, displayed on left side of the bar. -->

View file

@ -1,40 +1,7 @@
{% include 'global/header.tpl' %}
<div class="content homepage">
<div class="content-right content-column">
{% if user.checklogin %}
<div class="head">Hi, {{ user.data.username }}!</div>
<img src="//{{ sakura.urls.main }}/a/{{ user.data.id }}" class="default-avatar-setting homepage-menu-avatar" />
<ul>
<li><a href="//{{ sakura.urls.main }}/settings/profile" class="underline">Edit profile</a></li>
<li><a href="//{{ sakura.urls.main }}/settings/avatar" class="underline">Change avatar</a></li>
<li><a href="//{{ sakura.urls.main }}/settings/sessions" class="underline">View active sessions</a></li>
</ul>
<div class="clear"></div>
{% else %}
{% if sakura.lockauth %}
<div class="head">Whoops!</div>
You caught the site at the wrong moment! Right now registration <i>and</i> logging in is disabled for unspecified reasons. Sorry for the inconvenience but please try again later!
{% else %}
<div class="head">Welcome!</div>
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?
<a class="button registerbutton" href="/register">Register!</a>
<a class="button loginbutton" href="/login">Login</a>
{% endif %}
{% endif %}
<div class="head">Stats</div>
We have <b>{{ stats.userCount }}</b>,
<b><a href="/u/{{ stats.newestUser.id }}" class="default">{{ stats.newestUser.username }}</a></b> is the newest user,
it has been <b>{{ stats.lastRegDate }}</b> since the last user registered and
there's <b>{{ stats.chatOnline }}</b> in chat right now.
<div class="head">Online Users</div>
{% if stats.onlineUsers %}
All active users in the past 5 minutes:<br />
{% for amount,onlineUser in stats.onlineUsers %}
<a href="/u/{{ onlineUser.id }}" style="font-weight: bold;" class="default">{{ onlineUser.username }}</a>{% if amount != (stats.onlineUsers|length - 1) %}, {% endif %}
{% endfor %}
{% else %}
There were no online users in the past 5 minutes.
{% endif %}
{% include 'elements/indexPanel.tpl' %}
</div>
<div class="content-left content-column">
<div class="head">News <a href="/news.xml" class="fa fa-rss news-rss default"></a></div>
@ -51,7 +18,8 @@
/* * * DO NOT EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
var s = document.createElement('script');
s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);

View file

@ -26,7 +26,8 @@
<b>User hasn't logged in yet.</b>
{% else %}
<b>Last Seen on</b> {{ profile.user.lastdate|date("l Y-m-d H:i T") }}
{% endif %}
{% endif %}<br />
<b>User has {% if not profile.user.posts %}no{% else %}{{ profile.user.posts }}{% endif %} forum post{% if profile.user.posts != 1 %}s{% endif %}.</b>
{% if profile.data is not null %}
<hr class="default" />
{% if user.checklogin %}

View file

@ -1319,3 +1319,67 @@ textarea.inputStyling {
font-weight: 100;
font-size: 15px;
}
/* Forum */
.forum .forumList {
width: 100%;
border-spacing: 0;
margin-top: 2px;
}
.forum .forumList .forumCategory {
background: #C2AFFE;
font-weight: 700;
font-size: 17px;
color: inherit;
text-decoration: none;
}
.forum .forumList .forumCategory .forumCategoryTitleColumn {
padding: 4px;
}
.forum .forumList .forumForum {
height: 50px;
}
.forum .forumList .forumForum .forumIconColumn {
text-align: center;
width: 50px;
}
.forum .forumList .forumForum .forumIconColumn .forumIcon.read {
color: #444;
text-shadow: 0 0 5px #444;
}
.forum .forumList .forumForum .forumIconColumn .forumIcon.unread {
color: #6C5D7B;
text-shadow: 0 0 5px #9475B2;
}
.forum .forumList .forumForum .forumTitleColumn .name {
font-size: 1.2em;
line-height: 1.7em;
}
.forum .forumList .forumForum .forumTitleColumn .desc {
font-size: .8em;
line-height: 1em;
}
.forum .forumList .forumForum .forumCountColumn {
width: 70px;
text-align: center;
}
.forum .forumList .forumForum .forumCountColumn .topics {
font-size: 1.5em;
color: #111;
}
.forum .forumList .forumForum .forumCountColumn .posts {
font-size: .8em;
line-height: 1.2em;
color: #555;
}
.forum .forumList .forumForum .forumLastColumn {
width: 250px;
font-size: .9em;
line-height: 1.4em;
}
.forum .forumList .forumForum .forumLastColumn div,
.forum .forumList .forumForum .forumTitleColumn div {
padding-left: 5px;
}

View file

@ -11,7 +11,17 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak
// Add page specific things
$renderData['page'] = [
'title' => Configuration::getConfig('sitename') .' Forum'
'title' => 'Forum Listing',
'boards' => Forum::getBoardList()
];
$renderData['stats'] = [
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'),
'newestUser' => ($_INDEX_NEWEST_USER = max($_INDEX_USERS)),
'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'),
'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'),
'onlineUsers' => Users::checkAllOnline(),
'topicCount' => '0 topics',
'postCount' => '0 posts'
];
// Print page contents

10
forum/posting.php Normal file
View file

@ -0,0 +1,10 @@
<?php
/*
* Sakura Forum Posting
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';

10
forum/viewforum.php Normal file
View file

@ -0,0 +1,10 @@
<?php
/*
* Sakura Forum List Viewer
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';

10
forum/viewtopic.php Normal file
View file

@ -0,0 +1,10 @@
<?php
/*
* Sakura Forum Topic Viewer
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';

View file

@ -20,7 +20,9 @@ $renderData['stats'] = [
'newestUser' => ($_INDEX_NEWEST_USER = max($_INDEX_USERS)),
'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'),
'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'),
'onlineUsers' => Users::checkAllOnline()
'onlineUsers' => Users::checkAllOnline(),
'topicCount' => '0 topics',
'postCount' => '0 posts'
];
// Print page contents