Admin.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Action\Exception\ActionException;
  4. use dokuwiki\Extension\AdminPlugin;
  5. /**
  6. * Class Admin
  7. *
  8. * Action to show the admin interface or admin plugins
  9. *
  10. * @package dokuwiki\Action
  11. */
  12. class Admin extends AbstractUserAction {
  13. /** @inheritdoc */
  14. public function minimumPermission() {
  15. return AUTH_READ; // let in check later
  16. }
  17. /** @inheritDoc */
  18. public function preProcess() {
  19. global $INPUT;
  20. // retrieve admin plugin name from $_REQUEST['page']
  21. if($INPUT->str('page', '', true) != '') {
  22. /** @var AdminPlugin $plugin */
  23. if($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking
  24. if(!$plugin->isAccessibleByCurrentUser()) {
  25. throw new ActionException('denied');
  26. }
  27. $plugin->handle();
  28. }
  29. }
  30. }
  31. /** @inheritDoc */
  32. public function tplContent() {
  33. tpl_admin();
  34. }
  35. }