diff --git a/dokuwiki/action.php b/dokuwiki/action.php index a0ea2a8..14aa131 100644 --- a/dokuwiki/action.php +++ b/dokuwiki/action.php @@ -29,6 +29,7 @@ class action_plugin_hackerbase extends DokuWiki_Action_Plugin $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') { } } diff --git a/dokuwiki/syntax.php b/dokuwiki/syntax.php index eea0089..8be4e24 100644 --- a/dokuwiki/syntax.php +++ b/dokuwiki/syntax.php @@ -1,6 +1,6 @@ @@ -9,6 +9,8 @@ // must be run within DokuWiki if(!defined('DOKU_INC')) die(); +require_once("common.php"): + /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class @@ -30,39 +32,7 @@ class syntax_plugin_hackerbase extends DokuWiki_Syntax_Plugin { // $data is what the function handle return'ed. if($mode == 'xhtml'){ $spaceapi_status_json = $this->getConf("spaceapijson"); - $str = file_get_contents($spaceapi_status_json); - /** @var Doku_Renderer_xhtml $renderer */ - $status = "UNKNOWN"; - if ($str == FALSE) { - $status = "ERROR:FILE"; - } else { - $json = json_decode($str, true); - if ($json == NULL) { - $status = "ERROR:JSON"; - } else { - $opened = $json['state']['open']; - $lastchange = $json['state']['lastchange']; - $myfile = __FILE__; - $mydir = dirname($myfile); - $mydirname = basename($mydir); - $assetsdir = DOKU_BASE . "lib/plugins/" . $mydirname . "/assets"; - if ($opened == TRUE) { - $status = - '
Last changed: ' . $str_date . '
'; - } - } - } + $status = hackerbase_spaceapi_html_snippet($spaceapi_status_json); $renderer->doc .= $status; return true; }