diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index 62b4295..1eade3c 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -33,6 +33,7 @@ class HomeController extends Controller ->orderBy('user_id', 'desc') ->limit(1) ->get(['user_id']); + $newestUser = User::construct($newestUserId ? $newestUserId[0]->user_id : 0); // Get all the currently online users @@ -58,28 +59,27 @@ class HomeController extends Controller $onlineUsers[$user->id] = $user; } - //$news = new Category(config('general.news')); + $news = []; //new Category(config('general.news')); - Template::vars([ - 'news' => [], - 'stats' => [ - 'userCount' => DB::table('users') - ->where('rank_main', '!=', config('rank.banned')) - ->where('user_activated', 1) - ->where('user_restricted', 0) - ->count(), - 'newestUser' => $newestUser, - 'lastRegDate' => date_diff( - date_create(date('Y-m-d', $newestUser->registered)), - date_create(date('Y-m-d')) - )->format('%a'), - 'topicCount' => DB::table('topics')->where('forum_id', '!=', config('forum.trash'))->count(), - 'postCount' => DB::table('posts')->where('forum_id', '!=', config('forum.trash'))->count(), - 'onlineUsers' => $onlineUsers, - ], - ]); + $userCount = DB::table('users') + ->where('rank_main', '!=', config('rank.banned')) + ->where('user_activated', 1) + ->where('user_restricted', 0) + ->count(); - // Return the compiled page - return Template::render('meta/index'); + $lastRegDate = date_diff( + date_create(date('Y-m-d', $newestUser->registered)), + date_create(date('Y-m-d')) + )->format('%a'); + + $trashId = config('forum.trash'); + $topicCount = DB::table('topics') + ->where('forum_id', '!=', $trashId) + ->count(); + $postCount = DB::table('posts') + ->where('forum_id', '!=', $trashId) + ->count(); + + return view('home/index', compact('news', 'userCount', 'newestUser', 'lastRegDate', 'topicCount', 'postCount', 'onlineUsers')); } } diff --git a/resources/views/yuuno/meta/index.twig b/resources/views/yuuno/home/index.twig similarity index 80% rename from resources/views/yuuno/meta/index.twig rename to resources/views/yuuno/home/index.twig index f3aff0e..beabda5 100644 --- a/resources/views/yuuno/meta/index.twig +++ b/resources/views/yuuno/home/index.twig @@ -21,14 +21,14 @@ {% endif %}
Stats
- We have {{ stats.userCount }} user{% if stats.userCount != 1 %}s{% endif %}, - {{ stats.newestUser.username }} is the newest user, - it has been {{ stats.lastRegDate }} day{{ stats.lastRegDate == 1 ? '' : 's' }} since the last user registered and the forum has {{ stats.topicCount }} topic{% if stats.topicCount != 1 %}s{% endif %} and {{ stats.postCount }} post{% if stats.postCount != 1 %}s{% endif %}. + We have {{ userCount }} user{% if userCount != 1 %}s{% endif %}, + {{ newestUser.username }} is the newest user, + it has been {{ lastRegDate }} day{{ lastRegDate == 1 ? '' : 's' }} since the last user registered and the forum has {{ topicCount }} topic{% if topicCount != 1 %}s{% endif %} and {{ postCount }} post{% if postCount != 1 %}s{% endif %}.
Online Users
- {% if stats.onlineUsers %} + {% if onlineUsers %} All active users in the past 2 minutes - {% for amount, onlineUser in stats.onlineUsers %} + {% for amount, onlineUser in onlineUsers %}
diff --git a/resources/views/yuuno/master.twig b/resources/views/yuuno/master.twig index 1ab677d..dac915d 100644 --- a/resources/views/yuuno/master.twig +++ b/resources/views/yuuno/master.twig @@ -126,7 +126,7 @@ Yuuno.Main.Startup(); - {% if config('dev.show_changelog') and stats is defined %} + {% if config('dev.show_changelog') and server['REQUEST_URI'] == '/' %} Sakura.Changelog.Build(Sakura.DOM.ID('indexPanel')); {% endif %} diff --git a/resources/views/yuuno/meta/report.twig b/resources/views/yuuno/meta/report.twig deleted file mode 100644 index fc530f2..0000000 --- a/resources/views/yuuno/meta/report.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'master.twig' %} diff --git a/routes.php b/routes.php index fa34ae8..4a24367 100644 --- a/routes.php +++ b/routes.php @@ -18,7 +18,7 @@ Router::filter('maintenance', function () { }); Router::group(['before' => 'maintenance'], function () { - // Meta pages + // Homepage Router::get('/', 'HomeController@index', 'main.index'); // Link compatibility layer, prolly remove this in like a year