1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Ui\Login;
6use dokuwiki\Extension\Event;
7use dokuwiki\Ui;
8
9/**
10 * Class Denied
11 *
12 * Show the access denied screen
13 *
14 * @package dokuwiki\Action
15 */
16class Denied extends AbstractAction
17{
18    /** @inheritdoc */
19    public function minimumPermission()
20    {
21        return AUTH_NONE;
22    }
23
24    /** @inheritdoc */
25    public function tplContent()
26    {
27        $this->showBanner();
28
29        $data = null;
30        $event = new Event('ACTION_DENIED_TPLCONTENT', $data);
31        if ($event->advise_before()) {
32            global $INPUT;
33            if (empty($INPUT->server->str('REMOTE_USER')) && actionOK('login')) {
34                (new Login())->show();
35            }
36        }
37        $event->advise_after();
38    }
39
40    /**
41     * Display error on denied pages
42     *
43     * @author   Andreas Gohr <andi@splitbrain.org>
44     *
45     * @return void
46     */
47    public function showBanner()
48    {
49        // print intro
50        echo p_locale_xhtml('denied');
51    }
52}
53