From: Alexandre Emsenhuber Date: Fri, 3 Dec 2010 11:29:55 +0000 (+0000) Subject: Allow the submit callback function to return a Status object (will use this later... X-Git-Tag: 1.31.0-rc.0~33619 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=9e25ce6e0d95ccf7aba7f47470dc562ed3a26beb;p=lhc%2Fweb%2Fwiklou.git Allow the submit callback function to return a Status object (will use this later for other forms) --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index c51a9a8e97..fff1b40c48 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -209,7 +209,9 @@ class HTMLForm { $result = $this->trySubmit(); } - if ( $result === true ) { + if ( $result === true || + ( $result instanceof Status && $result->isGood() ) ) + { return $result; } @@ -460,7 +462,10 @@ class HTMLForm { * @return String */ function getErrors( $errors ) { - if ( is_array( $errors ) ) { + if ( $errors instanceof Status ) { + global $wgOut; + $errorstr = $wgOut->parse( $errors->getWikiText() ); + } elseif ( is_array( $errors ) ) { $errorstr = $this->formatErrors( $errors ); } else { $errorstr = $errors; diff --git a/includes/Preferences.php b/includes/Preferences.php index b9b120cb3d..deb17d088f 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1328,7 +1328,7 @@ class Preferences { $wgOut->redirect( $url ); } - return true; + return Status::newGood(); } public static function loadOldSearchNs( $user ) {