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