63 lines
2 KiB
PHP
63 lines
2 KiB
PHP
<?php
|
|
/**
|
|
* DokuWiki Plugin hackerbase (Action Component)
|
|
*
|
|
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
|
* @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
|
|
{
|
|
|
|
/** @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 = $INPUT->server->str('REMOTE_USER');
|
|
if (strlen($user) === 0) {
|
|
header("Location: /start?do=login");
|
|
die();
|
|
}
|
|
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 '<!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>';
|
|
die();
|
|
}
|
|
}
|
|
|
|
}
|