This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/main/index.php

28 lines
1.1 KiB
PHP
Raw Normal View History

2015-04-01 17:05:55 +00:00
<?php
/*
* Sakura Main Index
*/
// Declare Namespace
namespace Sakura;
// Include components
2015-04-06 16:15:20 +00:00
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
2015-04-01 17:05:55 +00:00
// Add page specific things
2015-04-06 19:51:26 +00:00
$renderData['newsPosts'] = Main::getNewsPosts(3);
2015-04-01 17:05:55 +00:00
$renderData['page'] = [
2015-04-25 20:37:02 +00:00
'title' => Configuration::getConfig('sitename'),
2015-04-06 19:51:26 +00:00
'articleCount' => count($renderData['newsPosts'])
2015-04-01 17:05:55 +00:00
];
2015-04-02 14:03:58 +00:00
$renderData['stats'] = [
2015-05-05 03:47:58 +00:00
'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'),
2015-04-27 00:41:59 +00:00
'onlineUsers' => Users::checkAllOnline()
2015-04-02 14:03:58 +00:00
];
2015-04-01 17:05:55 +00:00
// Print page contents
2015-04-06 21:57:17 +00:00
print Templates::render('main/index.tpl', $renderData);