193b8c351SAndreas Gohr<?php 293b8c351SAndreas Gohr 393b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item; 493b8c351SAndreas Gohr 5368ce258SAndreas Gohr/** 6368ce258SAndreas Gohr * Class Login 7368ce258SAndreas Gohr * 8368ce258SAndreas Gohr * Show a login or logout item, based on the current state 9368ce258SAndreas Gohr */ 10*33b91513SAndreas Gohrclass Login extends AbstractItem 11*33b91513SAndreas Gohr{ 1293b8c351SAndreas Gohr 1393b8c351SAndreas Gohr /** @inheritdoc */ 14*33b91513SAndreas Gohr public function __construct() 15*33b91513SAndreas Gohr { 1693b8c351SAndreas Gohr global $INPUT; 1793b8c351SAndreas Gohr parent::__construct(); 1893b8c351SAndreas Gohr 194bb2fc4aSAndreas Gohr $this->svg = DOKU_INC . 'lib/images/menu/login.svg'; 2093b8c351SAndreas Gohr $this->params['sectok'] = getSecurityToken(); 2193b8c351SAndreas Gohr if ($INPUT->server->has('REMOTE_USER')) { 2293b8c351SAndreas Gohr if (!actionOK('logout')) { 2393b8c351SAndreas Gohr throw new \RuntimeException("logout disabled"); 2493b8c351SAndreas Gohr } 2593b8c351SAndreas Gohr $this->params['do'] = 'logout'; 2693b8c351SAndreas Gohr $this->type = 'logout'; 27b85a7f3bSAndreas Gohr $this->svg = DOKU_INC . 'lib/images/menu/logout.svg'; 2893b8c351SAndreas Gohr } 2993b8c351SAndreas Gohr } 3093b8c351SAndreas Gohr 3193b8c351SAndreas Gohr} 32