1<?php 2/** 3 * logAuthError 4 * Log Authentification Error in apache error log 5 * @author Adrien Bettini <abettini@astrel.fr> 6 */ 7if(!defined('DOKU_INC')) die(); 8if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 9require_once(DOKU_PLUGIN.'action.php'); 10 11class action_plugin_logautherror extends DokuWiki_Action_Plugin { 12 13 /** 14 * return some info 15 * @see DokuWiki_Plugin::getInfo() 16 */ 17 function getInfo() { 18 return array( 19 'author' => 'Adrien Bettini', 20 'email' => 'abettini@astrel.fr', 21 'date' => '08/12/2011', 22 'name' => 'logAuthError', 23 'desc' => 'Log Authentification Error in apache error log', 24 'url' => 'http://www.astrel.fr/', 25 ); 26 } 27 28 /** 29 * Plugin should use this method to register its handlers with the dokuwiki's event controller 30 * @see DokuWiki_Action_Plugin::register() 31 */ 32 function register(&$controller) { 33 $controller->register_hook('AUTH_LOGIN_CHECK', 'AFTER', $this, '_logAuthError'); 34 } 35 36 /** 37 * Log Authentification Error in apache error log 38 * @param DOKU_EVENT $event 39 * @param array $param 40 */ 41 function _logAuthError(&$event, $param){ 42 if($event->result === false && !empty($event->data['user'])){ 43 error_log(str_replace(array('{userName}','{userPass}'), array($event->data['user'], $event->data['password']), $this->getConf('errorMsg')),0); 44 sleep(mt_rand(1,15)); 45 } 46 } 47} 48