[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Action/ -> Admin.php (source)

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