diff --git a/action.php b/action.php index d526b92..75869d0 100644 --- a/action.php +++ b/action.php @@ -43,6 +43,7 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin { /* session information */ private $sessionId = null; private $sessionType = ''; + private $showCaptcha = '-'; /** * Inserts tracking code to the page header @@ -118,8 +119,8 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin { $_SERVER['HTTP_REFERER'] ?? '', /* HTTP Referrer */ substr($conf['lang'],0,2), /* page language */ implode(',', array_unique(array_map( function($it) { return substr(trim($it),0,2); }, explode(',',trim($_SERVER['HTTP_ACCEPT_LANGUAGE'], " \t;,*"))))), /* accepted client languages */ - $this->getCountryCode() /* GeoIP country code */ - ); + $this->getCountryCode(), /* GeoIP country code */ + $this->showCaptcha /* show captcha? */ ); //* create the log line */ $filename = __DIR__ .'/logs/' . gmdate('Y-m-d') . '.srv.txt'; /* use GMT date for filename */ @@ -191,7 +192,10 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin { $useCaptcha = $this->getConf('useCaptcha'); - if ($useCaptcha !== 'disabled' && $this->checkCaptchaCookie()) { + if ($useCaptcha !== 'disabled' && $this->checkCaptchaCookie() && !$this->captchaWhitelisted()) { + + $this->showCaptcha = 'Y'; // captcha will be shown. + echo '
Found my IP in range: " . $col[0] . " - " . $col[1] . "
"; + return true; + } + } + } + } + } + + return false; + } + private function insertCaptchaLoader() { echo '