732B; PHP | 2019-03-26 18:04:07+01 | SLOC 24
1
<?php
2
3
namespace dokuwiki\Menu\Item;
4
5
/**
6
 * Class Login
7
 *
8
 * Show a login or logout item, based on the current state
9
 */
10
class Login extends AbstractItem {
11
12
    /** @inheritdoc */
13 2
    public function __construct() {
CamelCaseVariableName The variable $INPUT is not named in camelCase. (kritika/PHPMD) Filter like this
CamelCaseVariableName The variable $INPUT is not named in camelCase. (kritika/PHPMD) Filter like this
14
        global $INPUT;
15
        parent::__construct();
16
17
        $this->svg = DOKU_INC_COMPAT . 'lib/images/menu/login.svg';
18
        $this->params['sectok'] = getSecurityToken();
19
        if($INPUT->server->has('REMOTE_USER')) {
20
            if(!actionOK('logout')) {
21
                throw new \RuntimeException("logout disabled");
22
            }
23
            $this->params['do'] = 'logout';
24
            $this->type = 'logout';
25
            $this->svg = DOKU_INC_COMPAT . 'lib/images/menu/logout.svg';
26
        }
27
    }
28
29
}