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    /** @inheritdoc */
18    public function minimumPermission()
19    {
20        return AUTH_READ; // let in check later
21    }
22
23    /** @inheritDoc */
24    public function preProcess()
25    {
26        global $INPUT;
27
28        // retrieve admin plugin name from $_REQUEST['page']
29        if ($INPUT->str('page', '', true) != '') {
30            /** @var AdminPlugin $plugin */
31            if ($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking
32                if (!$plugin->isAccessibleByCurrentUser()) {
33                    throw new ActionException('denied');
34                }
35                $plugin->handle();
36            }
37        }
38    }
39
40    /** @inheritDoc */
41    public function tplContent()
42    {
43        tpl_admin();
44    }
45}
46