hackerbase/dokuwiki/action.php

35 lines
1.1 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>
*/
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 = preg_replace("/[^a-zA-Z0-9\-]+/", "", $INPUT->server->str('REMOTE_USER'));
echo file_get_contents($this->getConf("htmlexports") . $user . ".html");
die();
}
}
}