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