diff options
author | Anika Henke <anika@selfthinker.org> | 2014-02-02 14:43:06 +0000 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2014-02-02 14:43:06 +0000 |
commit | a051c2744a397f5ccbb688e0edab307451dc522d (patch) | |
tree | d9744944e50f2c23df22bd6856779bd228e129c4 /lib/plugins/extension/action.php | |
parent | 3641199a253e8f92f378f03926af80724ef04146 (diff) | |
parent | a8895ef5de970d5e6b1e273c3fe111b606611244 (diff) | |
download | rpg-a051c2744a397f5ccbb688e0edab307451dc522d.tar.gz rpg-a051c2744a397f5ccbb688e0edab307451dc522d.tar.bz2 |
Merge remote-tracking branch 'origin/master' into video-audio
Diffstat (limited to 'lib/plugins/extension/action.php')
-rw-r--r-- | lib/plugins/extension/action.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/plugins/extension/action.php b/lib/plugins/extension/action.php new file mode 100644 index 000000000..3f2ccaace --- /dev/null +++ b/lib/plugins/extension/action.php @@ -0,0 +1,66 @@ +<?php +/** DokuWiki Plugin extension (Action Component) + * + * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html + * @author Andreas Gohr <andi@splitbrain.org> + */ + +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +class action_plugin_extension extends DokuWiki_Action_Plugin { + + /** + * Registers a callback function for a given event + * + * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @return void + */ + public function register(Doku_Event_Handler $controller) { + + $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'info'); + + } + + /** + * Create the detail info for a single plugin + * + * @param Doku_Event $event + * @param $param + */ + public function info(Doku_Event &$event, $param){ + global $USERINFO; + global $INPUT; + + + if($event->data != 'plugin_extension') return; + $event->preventDefault(); + $event->stopPropagation(); + + if(empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])){ + http_status(403); + echo 'Forbidden'; + exit; + } + + header('Content-Type: text/html; charset=utf-8'); + + $ext = $INPUT->str('ext'); + if(!$ext) { + echo 'no extension given'; + return; + } + + /** @var helper_plugin_extension_extension $extension */ + $extension = plugin_load('helper', 'extension_extension'); + $extension->setExtension($ext); + + /** @var helper_plugin_extension_list $list */ + $list = plugin_load('helper', 'extension_list'); + + + echo $list->make_info($extension); + } + +} + |