Login.php 718 B

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