misuzu/public/manage/forum.php

38 lines
1.1 KiB
PHP
Raw Normal View History

2018-08-26 01:46:33 +00:00
<?php
2019-03-18 19:53:05 +00:00
use Misuzu\Request\RequestVar;
require_once '../../misuzu.php';
2018-08-26 01:46:33 +00:00
2019-03-18 19:53:05 +00:00
switch (RequestVar::get()->select('v')->string()) {
2018-08-26 01:46:33 +00:00
case 'listing':
$forums = db_query('SELECT * FROM `msz_forum_categories`');
$rawPerms = forum_perms_create();
$perms = manage_forum_perms_list($rawPerms);
2018-08-26 01:46:33 +00:00
if (!empty($_POST['perms']) && is_array($_POST['perms'])) {
$finalPerms = manage_perms_apply($perms, $_POST['perms'], $rawPerms);
$perms = manage_forum_perms_list($finalPerms);
tpl_var('calculated_perms', $finalPerms);
}
echo tpl_render('manage.forum.listing', compact('forums', 'perms'));
2018-08-26 01:46:33 +00:00
break;
case 'forum':
$getForum = db_prepare('
2018-08-26 01:46:33 +00:00
SELECT *
FROM `msz_forum_categories`
WHERE `forum_id` = :forum_id
');
2019-03-18 19:53:05 +00:00
$getForum->bindValue('forum_id', RequestVar::get()->select('f')->int());
$forum = db_fetch($getForum);
2018-08-26 01:46:33 +00:00
if (!$forum) {
echo render_error(404);
break;
}
echo tpl_render('manage.forum.forum', compact('forum'));
2018-08-26 01:46:33 +00:00
break;
}