r86139 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86138‎ | r86139 | r86140 >
Date:21:21, 15 April 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
followup r86137: re-enabled error messages on hook error for autoedit; small skin fix
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_AutoEditAjaxHandler.php (modified) (history)
  • /trunk/extensions/SemanticForms/skins/SF_autoedit.css (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -26,7 +26,7 @@
2727 SFUtils::loadMessages();
2828 }
2929
30 - function execute( $query ) {
 30+ function execute( $query, $redirectOnError = true ) {
3131 global $wgRequest, $wgOut;
3232
3333 $this->setHeaders();
@@ -43,7 +43,7 @@
4444
4545 $alt_forms = $wgRequest->getArray( 'alt_form' );
4646
47 - $msg = self::printForm( $this->mForm, $this->mTarget, $alt_forms, true );
 47+ $msg = self::printForm( $this->mForm, $this->mTarget, $alt_forms, $redirectOnError );
4848
4949 if ( $msg ) {
5050 // some error occurred
Index: trunk/extensions/SemanticForms/includes/SF_AutoEditAjaxHandler.php
@@ -1,4 +1,5 @@
22 <?php
 3+
34 /**
45 *
56 * @file
@@ -27,23 +28,15 @@
2829
2930 $title = new Title();
3031
31 - if ( version_compare( substr( $wgVersion, 0, 4 ), '1.17', '<' ) ) {
32 - // TODO: remove work around for bug in MW 1.16
33 - // get any contents already in putput buffer
34 - $obcontents = ob_get_contents();
 32+// if ( version_compare( substr( $wgVersion, 0, 4 ), '1.17', '<' ) ) {
 33+ if ( !StubObject::isRealObject( $wgParser ) )
 34+ $wgParser -> _unstub();
3535
3636 // perform offensive operation
37 - eval( '$wgParser -> startExternalParse( & $title, ParserOptions::newFromUser($wgUser), Parser::OT_HTML, true );' );
38 -
39 - // clean out the deprecation message (and everything else in the output buffer)
40 - ob_clean();
41 -
42 - // put former output buffer contents back in
43 - if ( $obcontents )
44 - echo $obcontents;
45 - } else {
4637 $wgParser -> startExternalParse( $title, ParserOptions::newFromUser( $wgUser ), Parser::OT_HTML, true );
47 - }
 38+// } else {
 39+// $wgParser -> startExternalParse( $title, ParserOptions::newFromUser( $wgUser ), Parser::OT_HTML, true );
 40+// }
4841
4942 // parse options
5043 $this -> parseDataFromQueryString( $this -> mOptions, $options, true );
@@ -152,9 +145,9 @@
153146
154147 // get the MW form
155148 if ( array_key_exists( 'target', $this -> mOptions ) ) {
156 - $formedit -> execute( $this -> mOptions[ 'form' ] . '/' . $this -> mOptions[ 'target' ] );
 149+ $formedit -> execute( $this -> mOptions[ 'form' ] . '/' . $this -> mOptions[ 'target' ], false );
157150 } else {
158 - $formedit -> execute( $this -> mOptions[ 'form' ] );
 151+ $formedit -> execute( $this -> mOptions[ 'form' ], false );
159152 }
160153
161154 $wgParser -> getOptions() -> enableLimitReport( false );
@@ -164,15 +157,14 @@
165158 $msg = $formedit -> mError; // Should this be sanitized? I.e. all html tags removed?
166159
167160 $msg = $wgParser -> parse(
168 - wfMsgReplaceArgs( $this -> mOptions[ 'error text' ], array( $msg ) ),
169 - $wgTitle,
170 - $wgParser -> getOptions()
 161+ wfMsgReplaceArgs( $this -> mOptions[ 'error text' ], array( $msg ) ),
 162+ $wgTitle,
 163+ $wgParser -> getOptions()
171164 ) -> getText();
172165
173166 $result = new AjaxResponse( $msg );
174167 $result -> setResponseCode( '400 Bad Request' );
175168 return $result;
176 -
177169 } else {
178170
179171 header( "X-Location: " . $wgOut -> getRedirect() );
Index: trunk/extensions/SemanticForms/skins/SF_autoedit.css
@@ -26,6 +26,10 @@
2727
2828 }
2929
 30+.autoedit-result > p:first-child {
 31+ display:inline;
 32+}
 33+
3034 .autoedit-result-wait {
3135 color: #555;
3236 cursor: progress;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86137bugfix: redirect on hook error to enable confirmEditfoxtrott20:09, 15 April 2011