splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace dokuwiki\Action; |
||
| 4 | |||
| 5 | use dokuwiki\Action\Exception\ActionException; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Class Admin |
||
| 9 | * |
||
| 10 | * Action to show the admin interface or admin plugins |
||
| 11 | * |
||
| 12 | * @package dokuwiki\Action |
||
| 13 | */ |
||
| 14 | class Admin extends AbstractUserAction { |
||
| 15 | |||
| 16 | /** @inheritdoc */ |
||
| 17 | function minimumPermission() { |
||
|
0 ignored issues
–
show
|
|||
| 18 | global $INFO; |
||
| 19 | |||
| 20 | if($INFO['ismanager']) { |
||
| 21 | return AUTH_READ; // let in check later |
||
| 22 | } else { |
||
| 23 | return AUTH_ADMIN; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function checkPermissions() { |
||
| 28 | parent::checkPermissions(); |
||
| 29 | |||
| 30 | global $INFO; |
||
| 31 | if(!$INFO['ismanager']) { |
||
| 32 | throw new ActionException('denied'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | public function preProcess() { |
||
| 37 | global $INPUT; |
||
| 38 | global $INFO; |
||
| 39 | |||
| 40 | // retrieve admin plugin name from $_REQUEST['page'] |
||
| 41 | if(($page = $INPUT->str('page', '', true)) != '') { |
||
| 42 | /** @var $plugin \DokuWiki_Admin_Plugin */ |
||
| 43 | if($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking |
||
| 44 | if($plugin->forAdminOnly() && !$INFO['isadmin']) { |
||
| 45 | throw new ActionException('denied'); |
||
| 46 | } |
||
| 47 | $plugin->handle(); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | public function tplContent() { |
||
| 53 | tpl_admin(); |
||
| 54 | } |
||
| 55 | |||
| 56 | } |
||
| 57 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.