2018-05-18 03:20:27 +02:00
|
|
|
<?php
|
|
|
|
use Misuzu\Database;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../misuzu.php';
|
|
|
|
|
2018-05-24 02:38:42 +02:00
|
|
|
$categories = forum_get_root_categories();
|
2018-05-24 02:57:13 +02:00
|
|
|
$blankForum = count($categories) <= 1 && $categories[0]['forum_children'] < 1;
|
2018-05-18 03:20:27 +02:00
|
|
|
|
|
|
|
foreach ($categories as $key => $category) {
|
2018-05-24 02:38:42 +02:00
|
|
|
$categories[$key]['forum_subforums'] = forum_get_children($category['forum_id'], $app->getUserId());
|
2018-05-18 03:20:27 +02:00
|
|
|
|
|
|
|
foreach ($categories[$key]['forum_subforums'] as $skey => $sub) {
|
2018-05-24 02:38:42 +02:00
|
|
|
if (!forum_may_have_children($sub['forum_type'])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:20:27 +02:00
|
|
|
$categories[$key]['forum_subforums'][$skey]['forum_subforums']
|
2018-05-24 02:38:42 +02:00
|
|
|
= forum_get_children($sub['forum_id'], $app->getUserId(), true);
|
2018-05-18 03:20:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $app->getTemplating()->render('forum.index', [
|
|
|
|
'forum_categories' => $categories,
|
2018-05-24 02:57:13 +02:00
|
|
|
'forum_empty' => $blankForum,
|
2018-05-18 03:20:27 +02:00
|
|
|
]);
|