Add do=brmstatus
This commit is contained in:
parent
cc99471482
commit
1818e93635
1 changed files with 44 additions and 22 deletions
|
@ -5,32 +5,54 @@
|
||||||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* @author Dominik Pantůček <dominik.pantucek@trustica.cz>
|
* @author Dominik Pantůček <dominik.pantucek@trustica.cz>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// must be run within DokuWiki
|
||||||
|
if(!defined('DOKU_INC')) die();
|
||||||
|
|
||||||
|
require_once("common.php");
|
||||||
|
|
||||||
class action_plugin_hackerbase extends DokuWiki_Action_Plugin
|
class action_plugin_hackerbase extends DokuWiki_Action_Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
public function register(Doku_Event_Handler $controller)
|
public function register(Doku_Event_Handler $controller)
|
||||||
{
|
{
|
||||||
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess');
|
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for ACTION_ACT_PREPROCESS
|
* Event handler for ACTION_ACT_PREPROCESS
|
||||||
*
|
*
|
||||||
* @see https://www.dokuwiki.org/devel:events:ACTION_ACT_PREPROCESS
|
* @see https://www.dokuwiki.org/devel:events:ACTION_ACT_PREPROCESS
|
||||||
* @param Doku_Event $event Event object
|
* @param Doku_Event $event Event object
|
||||||
* @param mixed $param optional parameter passed when event was registered
|
* @param mixed $param optional parameter passed when event was registered
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handleActionActPreprocess(Doku_Event $event, $param) {
|
public function handleActionActPreprocess(Doku_Event $event, $param) {
|
||||||
$act = act_clean($event->data);
|
$act = act_clean($event->data);
|
||||||
if ($act === 'payments') {
|
if ($act === 'payments') {
|
||||||
global $INPUT;
|
global $INPUT;
|
||||||
$user = preg_replace("/[^a-zA-Z0-9\-]+/", "", $INPUT->server->str('REMOTE_USER'));
|
$user = preg_replace("/[^a-zA-Z0-9\-]+/", "", $INPUT->server->str('REMOTE_USER'));
|
||||||
echo file_get_contents($this->getConf("htmlexports") . '/' . $user . ".html");
|
echo file_get_contents($this->getConf("htmlexports") . '/' . $user . ".html");
|
||||||
die();
|
die();
|
||||||
} else if ($act === 'brmstatus') {
|
} 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 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
||||||
|
echo '<html>';
|
||||||
|
echo '<head>';
|
||||||
|
echo '<title>Brmlab space status page</title>';
|
||||||
|
echo '<style>';
|
||||||
|
echo 'p {font: 80% "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;}';
|
||||||
|
echo 'h3 {font: 1em "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif; font-weight: bold;}';
|
||||||
|
echo '</style>';
|
||||||
|
echo '</head>';
|
||||||
|
echo '<body>';
|
||||||
|
echo $status;
|
||||||
|
echo '</body>';
|
||||||
|
echo '</html>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue