2018-05-18 01:20:27 +00:00
|
|
|
<?php
|
2018-10-04 20:30:55 +00:00
|
|
|
require_once '../../misuzu.php';
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-10-02 22:34:05 +00:00
|
|
|
$categories = forum_get_root_categories(user_session_current('user_id', 0));
|
2018-05-24 00:57:13 +00:00
|
|
|
$blankForum = count($categories) <= 1 && $categories[0]['forum_children'] < 1;
|
2018-05-18 01:20:27 +00:00
|
|
|
|
|
|
|
foreach ($categories as $key => $category) {
|
2019-01-03 15:57:17 +00:00
|
|
|
$categories[$key]['forum_subforums'] = forum_get_children(
|
|
|
|
$category['forum_id'],
|
|
|
|
user_session_current('user_id', 0),
|
|
|
|
perms_check($category['forum_permissions'], MSZ_FORUM_PERM_DELETE_TOPIC | MSZ_FORUM_PERM_DELETE_ANY_POST)
|
|
|
|
);
|
2018-05-18 01:20:27 +00:00
|
|
|
|
|
|
|
foreach ($categories[$key]['forum_subforums'] as $skey => $sub) {
|
2018-05-24 00:38:42 +00:00
|
|
|
if (!forum_may_have_children($sub['forum_type'])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-05-18 01:20:27 +00:00
|
|
|
$categories[$key]['forum_subforums'][$skey]['forum_subforums']
|
2019-01-03 15:57:17 +00:00
|
|
|
= forum_get_children(
|
|
|
|
$sub['forum_id'],
|
|
|
|
user_session_current('user_id', 0),
|
|
|
|
perms_check($sub['forum_permissions'], MSZ_FORUM_PERM_DELETE_TOPIC | MSZ_FORUM_PERM_DELETE_ANY_POST),
|
|
|
|
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,
|
2018-05-24 00:57:13 +00:00
|
|
|
'forum_empty' => $blankForum,
|
2018-05-18 01:20:27 +00:00
|
|
|
]);
|