, Andreas Gohr */ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'action.php'); class action_plugin_unameban extends DokuWiki_Action_Plugin { /** * register the eventhandlers and initialize some options */ function register(&$controller){ $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'handle_start', array()); } /** * Do the magic */ function handle_start(&$event, $param){ global $conf; $bans = @file($conf['cachedir'].'/unamebanplugin.txt'); $client = $_SERVER['REMOTE_USER']; if(is_array($bans)) foreach($bans as $ban){ $fields = explode("\t",$ban); if($fields[0] == $client){ $text = $this->locale_xhtml('banned'); $text .= sprintf('

'.$this->getLang('banned').'

', hsc($client), strftime($conf['dformat'],$fields[1]), hsc($fields[3])); $title = $this->getLang('denied'); header("HTTP/1.0 403 Forbidden"); echo<< $title
$text
EOT; exit; } } } }