aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Action/Locked.php
blob: 6849777bd31098a5c8cc257c569b5ee1d6f28856 (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

namespace dokuwiki\Action;

use dokuwiki\Ui\Editor;

/**
 * Class Locked
 *
 * Show a locked screen when a page is locked
 *
 * @package dokuwiki\Action
 */
class Locked extends AbstractAction
{
    /** @inheritdoc */
    public function minimumPermission()
    {
        return AUTH_READ;
    }

    /** @inheritdoc */
    public function tplContent()
    {
        $this->showBanner();
        (new Editor())->show();
    }

    /**
     * Display error on locked pages
     *
     * @return void
     * @author   Andreas Gohr <andi@splitbrain.org>
     *
     */
    public function showBanner()
    {
        global $ID;
        global $conf;
        global $lang;
        global $INFO;

        $locktime = filemtime(wikiLockFN($ID));
        $expire = dformat($locktime + $conf['locktime']);
        $min = round(($conf['locktime'] - (time() - $locktime)) / 60);

        // print intro
        echo p_locale_xhtml('locked');

        echo '<ul>';
        echo '<li><div class="li"><strong>' . $lang['lockedby'] . '</strong> ' .
            editorinfo($INFO['locked']) . '</div></li>';
        echo '<li><div class="li"><strong>' . $lang['lockexpire'] . '</strong> ' .
            $expire . ' (' . $min . ' min)</div></li>';
        echo '</ul>' . DOKU_LF;
    }
}