xref: /dokuwiki/inc/Menu/Item/Login.php (revision 8c51da59a9481debdfd66270530c691b0411cf9c)
1<?php
2
3namespace dokuwiki\Menu\Item;
4
5class Login extends AbstractItem {
6
7    protected $svg = DOKU_INC . 'lib/images/menu/login.svg';
8
9    /** @inheritdoc */
10    public function __construct() {
11        global $INPUT;
12        parent::__construct();
13
14        $this->params['sectok'] = getSecurityToken();
15        if($INPUT->server->has('REMOTE_USER')) {
16            if(!actionOK('logout')) {
17                throw new \RuntimeException("logout disabled");
18            }
19            $this->params['do'] = 'logout';
20            $this->type = 'logout';
21            $this->svg = DOKU_INC . 'lib/images/menu/logout.svg';
22        }
23    }
24
25}
26