*/ class action_plugin_ipban extends DokuWiki_Action_Plugin { /** * register the eventhandlers and initialize some options */ public function register(Doku_Event_Handler $controller) { $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'handle_start', array()); } /** * Do the magic * * @param Doku_Event $event * @param $param */ public function handle_start(Doku_Event $event, $param) { global $conf; $bans = @file($conf['cachedir'] . '/ipbanplugin.txt'); $client = clientIP(true); if (!is_array($bans)) return; // if the client isn't banned, we're done $banreason = $this->isBanned($client, $bans); if (!$banreason) return; // prepare template $text = $this->locale_xhtml('banned'); $text .= vsprintf('
' . $this->getLang('banned') . '
', array_map('hsc', $banreason)); $title = $this->getLang('denied'); // output http_status(403, 'Forbidden'); echo ''; echo ''; echo "