* @return bool true if the captcha should run
*/
function shouldCheck( &$editPage, $newtext, $section ) {
+ $this->trigger = '';
+
global $wgUser;
if( $wgUser->isAllowed( 'skipcaptcha' ) ) {
wfDebug( "ConfirmEdit: user group allows skipping captcha\n" );
if( $numLinks > 0 ) {
global $wgUser, $wgTitle;
- wfDebugLog( "captcha", sprintf( "ConfirmEdit: %dx url trigger by %s at [[%s]]: %s",
+ $this->trigger = sprintf( "%dx url trigger by '%s' at [[%s]]: %s",
$numLinks,
$wgUser->getName(),
$wgTitle->getPrefixedText(),
- implode( ", ", $addedLinks ) ) );
+ implode( ", ", $addedLinks ) );
return true;
}
}
if( $info ) {
global $wgRequest;
if( $this->keyMatch( $wgRequest, $info ) ) {
- wfDebug( "ConfirmEdit given proper key from form, passing.\n" );
+ $this->log( "passed" );
return true;
} else {
- wfDebug( "ConfirmEdit missing form key, prompting.\n" );
+ $this->log( "bad form input" );
}
} else {
- wfDebug( "ConfirmEdit: no session captcha key set, this is new visitor.\n" );
+ $this->log( "new captcha session" );
}
$editPage->showEditForm( array( &$this, 'formCallback' ) );
return false;
}
}
+ function log( $message ) {
+ wfDebugLog( 'captcha', 'ConfirmEdit: ' . $message . '; ' . $this->trigger );
+ }
+
/**
* Generate a captcha session ID and save the info in PHP's session storage.
* (Requires the user to have cookies enabled to get through the captcha.)