Locked.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Ui;
  4. /**
  5. * Class Locked
  6. *
  7. * Show a locked screen when a page is locked
  8. *
  9. * @package dokuwiki\Action
  10. */
  11. class Locked extends AbstractAction
  12. {
  13. /** @inheritdoc */
  14. public function minimumPermission()
  15. {
  16. return AUTH_READ;
  17. }
  18. /** @inheritdoc */
  19. public function tplContent()
  20. {
  21. $this->showBanner();
  22. (new Ui\Editor)->show();
  23. }
  24. /**
  25. * Display error on locked pages
  26. *
  27. * @author Andreas Gohr <andi@splitbrain.org>
  28. *
  29. * @return void
  30. */
  31. public function showBanner()
  32. {
  33. global $ID;
  34. global $conf;
  35. global $lang;
  36. global $INFO;
  37. $locktime = filemtime(wikiLockFN($ID));
  38. $expire = dformat($locktime + $conf['locktime']);
  39. $min = round(($conf['locktime'] - (time() - $locktime) )/60);
  40. // print intro
  41. print p_locale_xhtml('locked');
  42. print '<ul>';
  43. print '<li><div class="li"><strong>'.$lang['lockedby'].'</strong> '.editorinfo($INFO['locked']).'</div></li>';
  44. print '<li><div class="li"><strong>'.$lang['lockexpire'].'</strong> '.$expire.' ('.$min.' min)</div></li>';
  45. print '</ul>'.DOKU_LF;
  46. }
  47. }