1<?php 2/** DokuWiki Plugin extension (Action Component) 3 * 4 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 5 * @author Andreas Gohr <andi@splitbrain.org> 6 */ 7 8// must be run within Dokuwiki 9if(!defined('DOKU_INC')) die(); 10 11class action_plugin_extension extends DokuWiki_Action_Plugin { 12 13 /** 14 * Registers a callback function for a given event 15 * 16 * @param Doku_Event_Handler $controller DokuWiki's event controller object 17 * @return void 18 */ 19 public function register(Doku_Event_Handler $controller) { 20 21 $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'info'); 22 23 } 24 25 /** 26 * Create the detail info for a single plugin 27 * 28 * @param Doku_Event $event 29 * @param $param 30 */ 31 public function info(Doku_Event &$event, $param){ 32 global $USERINFO; 33 global $INPUT; 34 35 36 if($event->data != 'plugin_extension') return; 37 $event->preventDefault(); 38 $event->stopPropagation(); 39 40 if(empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])){ 41 http_status(403); 42 echo 'Forbidden'; 43 exit; 44 } 45 46 header('Content-Type: text/html; charset=utf-8'); 47 48 $ext = $INPUT->str('ext'); 49 if(!$ext) { 50 echo 'no extension given'; 51 return; 52 } 53 54 /** @var helper_plugin_extension_extension $extension */ 55 $extension = plugin_load('helper', 'extension_extension'); 56 $extension->setExtension($ext); 57 58 /** @var helper_plugin_extension_list $list */ 59 $list = plugin_load('helper', 'extension_list'); 60 61 62 echo $list->make_info($extension); 63 } 64 65} 66 67