aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/forum/configs.php
blob: c99f7184562f6360141170db5b6d858baf02040e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

class Course_Forum_ConfigsController extends Forum\BaseController
{
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);

        if (!$this->user_id) {
            throw new LoginException();
        }

        if (! $this->is_admin) {
            throw new AccessDeniedException();
        }
    }

    public function edit_action()
    {
        $this->config = Context::get()->getConfiguration();
    }

    public function save_action()
    {
        CSRFProtection::verifyUnsafeRequest();

        $this->config = Context::get()->getConfiguration();

        $this->config->store('FORUM_MODERATION_PERMISSION', trim(Request::option('forum_moderation_permission')));

        $this->config->store('FORUM_HIDE_CATEGORIES_NAVIGATION', Request::bool('forum_hide_categories_navigation'));

        PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));

        $this->relocate('course/forum/topics');
    }
}