diff --git a/dokuwiki/action.php b/dokuwiki/action.php index 14aa131..0ddb1d8 100644 --- a/dokuwiki/action.php +++ b/dokuwiki/action.php @@ -5,32 +5,54 @@ * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html * @author Dominik Pantůček */ + + // must be run within DokuWiki +if(!defined('DOKU_INC')) die(); + +require_once("common.php"); + class action_plugin_hackerbase extends DokuWiki_Action_Plugin { - /** @inheritDoc */ - public function register(Doku_Event_Handler $controller) - { - $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess'); - } + /** @inheritDoc */ + public function register(Doku_Event_Handler $controller) + { + $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess'); + } - /** - * Event handler for ACTION_ACT_PREPROCESS - * - * @see https://www.dokuwiki.org/devel:events:ACTION_ACT_PREPROCESS - * @param Doku_Event $event Event object - * @param mixed $param optional parameter passed when event was registered - * @return void - */ - public function handleActionActPreprocess(Doku_Event $event, $param) { - $act = act_clean($event->data); - if ($act === 'payments') { - global $INPUT; - $user = preg_replace("/[^a-zA-Z0-9\-]+/", "", $INPUT->server->str('REMOTE_USER')); - echo file_get_contents($this->getConf("htmlexports") . '/' . $user . ".html"); - die(); - } else if ($act === 'brmstatus') { - } + /** + * Event handler for ACTION_ACT_PREPROCESS + * + * @see https://www.dokuwiki.org/devel:events:ACTION_ACT_PREPROCESS + * @param Doku_Event $event Event object + * @param mixed $param optional parameter passed when event was registered + * @return void + */ + public function handleActionActPreprocess(Doku_Event $event, $param) { + $act = act_clean($event->data); + if ($act === 'payments') { + global $INPUT; + $user = preg_replace("/[^a-zA-Z0-9\-]+/", "", $INPUT->server->str('REMOTE_USER')); + echo file_get_contents($this->getConf("htmlexports") . '/' . $user . ".html"); + die(); + } else if ($act === 'brmstatus') { + $spaceapi_status_json = $this->getConf("spaceapijson"); + $status = hackerbase_spaceapi_html_snippet($spaceapi_status_json); + // The following was taken from original /var/www/status-renderer/status.php verbatim for now: + echo ''; + echo ''; + echo ''; + echo 'Brmlab space status page'; + echo ''; + echo ''; + echo ''; + echo $status; + echo ''; + echo ''; } + } }