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 if(empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])){ 36 http_status(403); 37 echo 'Forbidden'; 38 exit; 39 } 40 41 if($event->data != 'plugin_extension') return; 42 $event->preventDefault(); 43 $event->stopPropagation(); 44 45 header('Content-Type: text/html; charset=utf-8'); 46 47 $ext = $INPUT->str('ext'); 48 if(!$ext) { 49 echo 'no extension given'; 50 return; 51 } 52 53 /** @var helper_plugin_extension_extension $extension */ 54 $extension = plugin_load('helper', 'extension_extension'); 55 $extension->setExtension($ext); 56 57 /** @var helper_plugin_extension_list $list */ 58 $list = plugin_load('helper', 'extension_list'); 59 60 61 echo $list->make_info($extension); 62 } 63 64} 65 66