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