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-06-29 00:36:37 +00:00
|
|
|
|
2015-08-18 23:29:45 +00:00
|
|
|
$meow = new User(2);
|
|
|
|
|
|
|
|
print_r($meow->user);
|
|
|
|
|
2015-06-27 11:03:11 +00:00
|
|
|
// Are we in forum mode?
|
|
|
|
$forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false;
|
|
|
|
|
2015-04-01 17:05:55 +00:00
|
|
|
// Add page specific things
|
2015-07-30 01:12:53 +00:00
|
|
|
$renderData['newsPosts'] = ($forumMode ? null : Main::getNewsPosts(Configuration::getConfig('front_page_news_posts')));
|
2015-06-27 19:29:37 +00:00
|
|
|
|
2015-04-01 17:05:55 +00:00
|
|
|
$renderData['page'] = [
|
2015-07-08 13:09:57 +00:00
|
|
|
'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')),
|
|
|
|
'friend_req' => Users::getPendingFriends()
|
2015-06-27 19:29:37 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
$renderData['board'] = [
|
2015-06-29 00:36:37 +00:00
|
|
|
'forums' => ($forumMode ? Forum::getForumList() : null),
|
|
|
|
'viewforum' => false,
|
|
|
|
'viewtopic' => false
|
2015-04-01 17:05:55 +00:00
|
|
|
];
|
2015-06-27 19:29:37 +00:00
|
|
|
|
2015-04-02 14:03:58 +00:00
|
|
|
$renderData['stats'] = [
|
2015-06-27 19:29:37 +00:00
|
|
|
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'),
|
2015-08-11 00:54:37 +00:00
|
|
|
'newestUser' => ($_INDEX_NEWEST_USER = empty($_INDEX_USERS) ? Users::getUser(0) : max($_INDEX_USERS)),
|
2015-06-27 19:29:37 +00:00
|
|
|
'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'),
|
2015-05-06 13:42:02 +00:00
|
|
|
'onlineUsers' => Users::checkAllOnline(),
|
2015-06-29 00:36:37 +00:00
|
|
|
'topicCount' => ($_TOPICS = count(Database::fetch('topics'))) .' topic'. ($_TOPICS != 1 ? 's' : ''),
|
|
|
|
'postCount' => ($_POSTS = count(Database::fetch('posts'))) .' post'. ($_POSTS != 1 ? 's' : '')
|
2015-04-02 14:03:58 +00:00
|
|
|
];
|
2015-04-01 17:05:55 +00:00
|
|
|
|
|
|
|
// Print page contents
|
2015-06-27 11:03:11 +00:00
|
|
|
print Templates::render(($forumMode ? 'forum' : 'main') .'/index.tpl', $renderData);
|