xref: /dokuwiki/inc/Menu/Item/Revert.php (revision e44b94a4bd0679ff22e14add34b60590fe7077d3)
193b8c351SAndreas Gohr<?php
293b8c351SAndreas Gohr
393b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item;
493b8c351SAndreas Gohr
5368ce258SAndreas Gohr/**
6368ce258SAndreas Gohr * Class Revert
7368ce258SAndreas Gohr *
8368ce258SAndreas Gohr * Quick revert to the currently shown page revision
9368ce258SAndreas Gohr */
10601a1f60SAndreas Gohrclass Revert extends AbstractItem
11601a1f60SAndreas Gohr{
1293b8c351SAndreas Gohr    /** @inheritdoc */
13601a1f60SAndreas Gohr    public function __construct()
14601a1f60SAndreas Gohr    {
1593b8c351SAndreas Gohr        global $REV;
1693b8c351SAndreas Gohr        global $INFO;
17601a1f60SAndreas Gohr        global $INPUT;
1893b8c351SAndreas Gohr        parent::__construct();
1993b8c351SAndreas Gohr
20601a1f60SAndreas Gohr        if (!$REV || !$INFO['writable'] || $INPUT->server->str('REMOTE_USER') === '') {
2193b8c351SAndreas Gohr            throw new \RuntimeException('revert not available');
2293b8c351SAndreas Gohr        }
2393b8c351SAndreas Gohr        $this->params['rev'] = $REV;
2493b8c351SAndreas Gohr        $this->params['sectok'] = getSecurityToken();
25*e44b94a4SAndreas Gohr        $this->svg = DOKU_INC . 'lib/images/menu/06-revert_replay.svg';
2693b8c351SAndreas Gohr    }
2793b8c351SAndreas Gohr}
28