mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-27 17:40:11 +00:00
* (bug 28783) Declaration of ReCaptcha::confirmEdit() incompatible with that of SimpleCaptcha::confirmEdit()
Fix whitespace also
This commit is contained in:
parent
196b50f98c
commit
a4e11ba3f0
|
@ -52,13 +52,12 @@ function efReCaptcha() {
|
||||||
|
|
||||||
|
|
||||||
class ReCaptcha extends SimpleCaptcha {
|
class ReCaptcha extends SimpleCaptcha {
|
||||||
|
|
||||||
//reCAPTHCA error code returned from recaptcha_check_answer
|
//reCAPTHCA error code returned from recaptcha_check_answer
|
||||||
private $recaptcha_error = null;
|
private $recaptcha_error = null;
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* Displays the reCAPTCHA widget.
|
||||||
* Displays the reCAPTCHA widget.
|
|
||||||
* If $this->recaptcha_error is set, it will display an error in the widget.
|
* If $this->recaptcha_error is set, it will display an error in the widget.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -68,12 +67,10 @@ class ReCaptcha extends SimpleCaptcha {
|
||||||
recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error);
|
recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the library function recaptcha_check_answer to verify the users input.
|
* Calls the library function recaptcha_check_answer to verify the users input.
|
||||||
* Sets $this->recaptcha_error if the user is incorrect.
|
* Sets $this->recaptcha_error if the user is incorrect.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function passCaptcha() {
|
function passCaptcha() {
|
||||||
|
@ -91,36 +88,32 @@ class ReCaptcha extends SimpleCaptcha {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called on all edit page saves. (EditFilter events)
|
||||||
|
* @return boolean - true if page save should continue, false if should display Captcha widget.
|
||||||
|
*/
|
||||||
|
function confirmEdit( $editPage, $newtext, $section, $merged = false ) {
|
||||||
|
if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
|
||||||
|
|
||||||
|
if (!isset($_POST['recaptcha_response_field'])) {
|
||||||
|
//User has not yet been presented with Captcha, show the widget.
|
||||||
|
$editPage->showEditForm( array( &$this, 'editCallback' ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
if( $this->passCaptcha() ) {
|
||||||
* Called on all edit page saves. (EditFilter events)
|
return true;
|
||||||
* @return boolean - true if page save should continue, false if should display Captcha widget.
|
} else {
|
||||||
*/
|
//Try again - show the widget
|
||||||
function confirmEdit( $editPage, $newtext, $section ) {
|
$editPage->showEditForm( array( &$this, 'editCallback' ) );
|
||||||
if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($_POST['recaptcha_response_field'])) {
|
} else {
|
||||||
//User has not yet been presented with Captcha, show the widget.
|
wfDebug( "ConfirmEdit: no need to show captcha.\n" );
|
||||||
$editPage->showEditForm( array( &$this, 'editCallback' ) );
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->passCaptcha() ) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
//Try again - show the widget
|
|
||||||
$editPage->showEditForm( array( &$this, 'editCallback' ) );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
wfDebug( "ConfirmEdit: no need to show captcha.\n" );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a message asking the user to enter a captcha on edit
|
* Show a message asking the user to enter a captcha on edit
|
||||||
|
|
Loading…
Reference in a new issue