xref: /dokuwiki/inc/Menu/Item/Login.php (revision b85a7f3bd0cd2f5f52b55bd3de0c7869787662fb)
193b8c351SAndreas Gohr<?php
293b8c351SAndreas Gohr
393b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item;
493b8c351SAndreas Gohr
593b8c351SAndreas Gohrclass Login extends AbstractItem {
693b8c351SAndreas Gohr
7*b85a7f3bSAndreas Gohr    protected $svg = DOKU_INC . 'lib/images/menu/login.svg';
8*b85a7f3bSAndreas Gohr
993b8c351SAndreas Gohr    /** @inheritdoc */
1093b8c351SAndreas Gohr    public function __construct() {
1193b8c351SAndreas Gohr        global $INPUT;
1293b8c351SAndreas Gohr        parent::__construct();
1393b8c351SAndreas Gohr
1493b8c351SAndreas Gohr        $this->category = 'user';
1593b8c351SAndreas Gohr        $this->params['sectok'] = getSecurityToken();
1693b8c351SAndreas Gohr        if($INPUT->server->has('REMOTE_USER')) {
1793b8c351SAndreas Gohr            if(!actionOK('logout')) {
1893b8c351SAndreas Gohr                throw new \RuntimeException("logout disabled");
1993b8c351SAndreas Gohr            }
2093b8c351SAndreas Gohr            $this->params['do'] = 'logout';
2193b8c351SAndreas Gohr            $this->type = 'logout';
22*b85a7f3bSAndreas Gohr            $this->svg = DOKU_INC . 'lib/images/menu/logout.svg';
2393b8c351SAndreas Gohr        }
2493b8c351SAndreas Gohr    }
2593b8c351SAndreas Gohr
2693b8c351SAndreas Gohr}
27