xref: /dokuwiki/inc/Action/Admin.php (revision dccd6b2bba7367e4d1d2d7aa84c9f9d15584b593)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionException;
6use dokuwiki\Extension\AdminPlugin;
7
8/**
9 * Class Admin
10 *
11 * Action to show the admin interface or admin plugins
12 *
13 * @package dokuwiki\Action
14 */
15class Admin extends AbstractUserAction
16{
17
18    /** @inheritdoc */
19    public function minimumPermission()
20    {
21        return AUTH_READ; // let in check later
22    }
23
24    /** @inheritDoc */
25    public function preProcess()
26    {
27        global $INPUT;
28
29        // retrieve admin plugin name from $_REQUEST['page']
30        if($INPUT->str('page', '', true) != '') {
31            /** @var AdminPlugin $plugin */
32            if($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking
33                if(!$plugin->isAccessibleByCurrentUser()) {
34                    throw new ActionException('denied');
35                }
36                $plugin->handle();
37            }
38        }
39    }
40
41    /** @inheritDoc */
42    public function tplContent()
43    {
44        tpl_admin();
45    }
46}
47