From: Alexandre Emsenhuber Date: Thu, 17 Nov 2011 10:06:56 +0000 (+0000) Subject: * Removed Preferences::validateEmail() to that e-mail address modification is in... X-Git-Tag: 1.31.0-rc.0~26448 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=8758594579788903d837f599c87d066153d2015f;p=lhc%2Fweb%2Fwiklou.git * Removed Preferences::validateEmail() to that e-mail address modification is in another special page, no callers * Added $form parameter to Preferences::cleanSignature() and Preferences::validateSignature(), they are passed to the functions since r102879 * Use local context to get messages --- diff --git a/includes/Preferences.php b/includes/Preferences.php index 122cbffd36..b82d662f35 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1160,19 +1160,20 @@ class Preferences { } /** - * @param $signature - * @param $alldata + * @param $signature string + * @param $alldata array + * @param $form HTMLForm * @return bool|string */ - static function validateSignature( $signature, $alldata ) { + static function validateSignature( $signature, $alldata, $form ) { global $wgParser, $wgMaxSigChars; if ( mb_strlen( $signature ) > $wgMaxSigChars ) { return Xml::element( 'span', array( 'class' => 'error' ), - wfMessage( 'badsiglength' )->numParams( $wgMaxSigChars )->text() ); + $form->msg( 'badsiglength' )->numParams( $wgMaxSigChars )->text() ); } elseif ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] && false === $wgParser->validateSig( $signature ) ) { - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) ); + return Xml::element( 'span', array( 'class' => 'error' ), $form->msg( 'badsig' )->text() ); } else { return true; } @@ -1181,9 +1182,10 @@ class Preferences { /** * @param $signature string * @param $alldata array + * @param $form HTMLForm * @return string */ - static function cleanSignature( $signature, $alldata ) { + static function cleanSignature( $signature, $alldata, $form ) { global $wgParser; if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) { $signature = $wgParser->cleanSig( $signature ); @@ -1195,23 +1197,6 @@ class Preferences { return $signature; } - /** - * @param $email - * @param $alldata - * @return bool|String - */ - static function validateEmail( $email, $alldata ) { - if ( $email && !Sanitizer::validateEmail( $email ) ) { - return wfMsgExt( 'invalidemailaddress', 'parseinline' ); - } - - global $wgEmailConfirmToEdit; - if ( $wgEmailConfirmToEdit && !$email ) { - return wfMsgExt( 'noemailtitle', 'parseinline' ); - } - return true; - } - /** * @param $user User * @param $context IContextSource @@ -1229,7 +1214,7 @@ class Preferences { $htmlForm->setModifiedUser( $user ); $htmlForm->setId( 'mw-prefs-form' ); - $htmlForm->setSubmitText( wfMsg( 'saveprefs' ) ); + $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() ); # Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save' $htmlForm->setSubmitTooltip( 'preferences-save' ); $htmlForm->setSubmitID( 'prefsubmit' ); @@ -1532,7 +1517,7 @@ class PreferencesForm extends HTMLForm { $t = SpecialPage::getTitleFor( 'Preferences', 'reset' ); - $html .= "\n" . Linker::link( $t, wfMsgHtml( 'restoreprefs' ) ); + $html .= "\n" . Linker::link( $t, $this->msg( 'restoreprefs' )->escaped() ); $html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons' ), $html );