fixing stats

This commit is contained in:
Pachira 2015-04-02 16:03:58 +02:00
parent 50ebc7c8d2
commit 9701643696
2 changed files with 10 additions and 4 deletions

View file

@ -6,10 +6,10 @@
<a class="button registerbutton" href="/register">Register!</a>
<a class="button loginbutton" href="/login">Login</a>
<div class="head">Stats</div>
We have <b>{{ frontpage.stats.usercount }}</b>,
<b><a href="/u/{{ frontpage.stats.latestid }}" class="default">{{ frontpage.stats.latestname }}</a></b> is the newest user,
it has been <b>{{ frontpage.stats.lastsignup }}</b> since the last user registered and
there are <b>{{ frontpage.stats.usersinchat }}</b> in chat right now.
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 are <b>{{ stats.chatOnline }}</b> in chat right now.
</div>
<div class="content-left content-column">
<div class="head">News <a href="/news.xml" class="fa fa-rss news-rss default"></a></div>

View file

@ -13,6 +13,12 @@ require_once '/var/www/flashii.net/_sakura/sakura.php';
$renderData['page'] = [
'title' => 'Flashii Dev'
];
$renderData['stats'] = [
'userCount' => ($userCount = count($users = Users::getAllUsers())) .' user'. ($userCount == 1 ? '' : 's'),
'newestUser' => max($users),
'lastRegDate' => ($lastRegDate = date_diff(date_create(date('Y-m-d', max($users)['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($lastRegDate == 1 ? '' : 's'),
'chatOnline' => ($chatOnline = 0) .'user'. ($chatOnline == 1 ? '' : 's')
];
$renderData['newsPosts'] = Main::getNewsPosts(3);
// Print page contents