misuzu/public/manage/forum.php

36 lines
1.1 KiB
PHP
Raw Normal View History

2018-08-26 01:46:33 +00:00
<?php
require_once '../../misuzu.php';
2018-08-26 01:46:33 +00:00
switch ($_GET['v'] ?? null) {
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
');
$getForum->bindValue('forum_id', (int)($_GET['f'] ?? 0));
$forum = $getForum->execute() ? $getForum->fetch(PDO::FETCH_ASSOC) : false;
if (!$forum) {
echo render_error(404);
break;
}
echo tpl_render('manage.forum.forum', compact('forum'));
2018-08-26 01:46:33 +00:00
break;
}