misuzu/public/forum/index.php

24 lines
812 B
PHP
Raw Normal View History

2018-05-18 01:20:27 +00:00
<?php
require_once '../../misuzu.php';
2018-05-18 01:20:27 +00:00
$categories = forum_get_root_categories(user_session_current('user_id', 0));
$blankForum = count($categories) <= 1 && $categories[0]['forum_children'] < 1;
2018-05-18 01:20:27 +00:00
foreach ($categories as $key => $category) {
$categories[$key]['forum_subforums'] = forum_get_children($category['forum_id'], user_session_current('user_id', 0));
2018-05-18 01:20:27 +00:00
foreach ($categories[$key]['forum_subforums'] as $skey => $sub) {
if (!forum_may_have_children($sub['forum_type'])) {
continue;
}
2018-05-18 01:20:27 +00:00
$categories[$key]['forum_subforums'][$skey]['forum_subforums']
= forum_get_children($sub['forum_id'], user_session_current('user_id', 0), true);
2018-05-18 01:20:27 +00:00
}
}
2018-08-15 01:12:58 +00:00
echo tpl_render('forum.index', [
2018-05-18 01:20:27 +00:00
'forum_categories' => $categories,
'forum_empty' => $blankForum,
2018-05-18 01:20:27 +00:00
]);