r87299 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87298‎ | r87299 | r87300 >
Date:21:26, 2 May 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 28783) Declaration of ReCaptcha::confirmEdit() incompatible with that of SimpleCaptcha::confirmEdit()

Fix whitespace also
Modified paths:
  • /trunk/extensions/ConfirmEdit/ReCaptcha.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/ReCaptcha.php
@@ -52,13 +52,12 @@
5353
5454
5555 class ReCaptcha extends SimpleCaptcha {
56 -
 56+
5757 //reCAPTHCA error code returned from recaptcha_check_answer
5858 private $recaptcha_error = null;
5959
60 -
61 - /**
62 - * Displays the reCAPTCHA widget.
 60+ /**
 61+ * Displays the reCAPTCHA widget.
6362 * If $this->recaptcha_error is set, it will display an error in the widget.
6463 *
6564 */
@@ -68,12 +67,10 @@
6968 recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error);
7069 }
7170
72 -
73 -
7471 /**
7572 * Calls the library function recaptcha_check_answer to verify the users input.
7673 * Sets $this->recaptcha_error if the user is incorrect.
77 - * @return boolean
 74+ * @return boolean
7875 *
7976 */
8077 function passCaptcha() {
@@ -91,37 +88,33 @@
9289
9390 }
9491
 92+ /**
 93+ * Called on all edit page saves. (EditFilter events)
 94+ * @return boolean - true if page save should continue, false if should display Captcha widget.
 95+ */
 96+ function confirmEdit( $editPage, $newtext, $section, $merged = false ) {
 97+ if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
9598
 99+ if (!isset($_POST['recaptcha_response_field'])) {
 100+ //User has not yet been presented with Captcha, show the widget.
 101+ $editPage->showEditForm( array( &$this, 'editCallback' ) );
 102+ return false;
 103+ }
96104
97 - /**
98 - * Called on all edit page saves. (EditFilter events)
99 - * @return boolean - true if page save should continue, false if should display Captcha widget.
100 - */
101 - function confirmEdit( $editPage, $newtext, $section ) {
102 - if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
 105+ if( $this->passCaptcha() ) {
 106+ return true;
 107+ } else {
 108+ //Try again - show the widget
 109+ $editPage->showEditForm( array( &$this, 'editCallback' ) );
 110+ return false;
 111+ }
103112
104 - if (!isset($_POST['recaptcha_response_field'])) {
105 - //User has not yet been presented with Captcha, show the widget.
106 - $editPage->showEditForm( array( &$this, 'editCallback' ) );
107 - return false;
108 - }
 113+ } else {
 114+ wfDebug( "ConfirmEdit: no need to show captcha.\n" );
 115+ return true;
 116+ }
 117+ }
109118
110 - if( $this->passCaptcha() ) {
111 - return true;
112 - } else {
113 - //Try again - show the widget
114 - $editPage->showEditForm( array( &$this, 'editCallback' ) );
115 - return false;
116 - }
117 -
118 - } else {
119 - wfDebug( "ConfirmEdit: no need to show captcha.\n" );
120 - return true;
121 - }
122 - }
123 -
124 -
125 -
126119 /**
127120 * Show a message asking the user to enter a captcha on edit
128121 * The result will be treated as wiki text

Status & tagging log