1f21dad39SAndreas Gohr<?php 2f21dad39SAndreas Gohr 3f21dad39SAndreas Gohrnamespace dokuwiki\Action; 4f21dad39SAndreas Gohr 5f21dad39SAndreas Gohruse dokuwiki\Action\Exception\ActionException; 6f21dad39SAndreas Gohr 7ab583a1bSAndreas Gohr/** 8ab583a1bSAndreas Gohr * Class Admin 9ab583a1bSAndreas Gohr * 10ab583a1bSAndreas Gohr * Action to show the admin interface or admin plugins 11ab583a1bSAndreas Gohr * 12ab583a1bSAndreas Gohr * @package dokuwiki\Action 13ab583a1bSAndreas Gohr */ 14f21dad39SAndreas Gohrclass Admin extends AbstractUserAction { 15f21dad39SAndreas Gohr 16f21dad39SAndreas Gohr /** @inheritdoc */ 17ec701221SAndreas Gohr public function minimumPermission() { 18f21dad39SAndreas Gohr global $INFO; 19f21dad39SAndreas Gohr 20f21dad39SAndreas Gohr if($INFO['ismanager']) { 21f21dad39SAndreas Gohr return AUTH_READ; // let in check later 22f21dad39SAndreas Gohr } else { 23f21dad39SAndreas Gohr return AUTH_ADMIN; 24f21dad39SAndreas Gohr } 25f21dad39SAndreas Gohr } 26f21dad39SAndreas Gohr 27b2c9cd19SAndreas Gohr public function checkPreconditions() { 28b2c9cd19SAndreas Gohr parent::checkPreconditions(); 29f21dad39SAndreas Gohr 30f21dad39SAndreas Gohr global $INFO; 31f21dad39SAndreas Gohr if(!$INFO['ismanager']) { 32f21dad39SAndreas Gohr throw new ActionException('denied'); 33f21dad39SAndreas Gohr } 34f21dad39SAndreas Gohr } 35f21dad39SAndreas Gohr 36f21dad39SAndreas Gohr public function preProcess() { 37f21dad39SAndreas Gohr global $INPUT; 38f21dad39SAndreas Gohr global $INFO; 39f21dad39SAndreas Gohr 40f21dad39SAndreas Gohr // retrieve admin plugin name from $_REQUEST['page'] 41f21dad39SAndreas Gohr if(($page = $INPUT->str('page', '', true)) != '') { 42f21dad39SAndreas Gohr /** @var $plugin \DokuWiki_Admin_Plugin */ 43f21dad39SAndreas Gohr if($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking 44*64cdf779SAndreas Gohr if(!$plugin->isAccessibleByCurrentUser()) { 45f21dad39SAndreas Gohr throw new ActionException('denied'); 46f21dad39SAndreas Gohr } 47f21dad39SAndreas Gohr $plugin->handle(); 48f21dad39SAndreas Gohr } 49f21dad39SAndreas Gohr } 50f21dad39SAndreas Gohr } 51f21dad39SAndreas Gohr 52f21dad39SAndreas Gohr public function tplContent() { 53f21dad39SAndreas Gohr tpl_admin(); 54f21dad39SAndreas Gohr } 55f21dad39SAndreas Gohr 56f21dad39SAndreas Gohr} 57