From bc6984b10addf95c80c13809045f83ea2ad5b6c6 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 7 Jan 2006 23:37:40 +0000 Subject: [PATCH] * Change order of things in pre-save transform, so that the forced substitution in cleaned signatures will *do something* * Remove now-redundant message from Language.php * Improve signature validation in user preferences; poor XML causes the user to be screamed at; signatures still silent-cleaned upon changing --- includes/Parser.php | 14 ++++++-------- includes/SpecialPreferences.php | 10 ++++++++-- languages/Language.php | 3 +-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 8c76343e78..a1662389b7 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3133,14 +3133,6 @@ class Parser function pstPass2( $text, &$user ) { global $wgContLang, $wgLocaltimezone; - # Variable replacement - # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags - $text = $this->replaceVariables( $text ); - - # Signatures - # - $sigText = $this->getUserSig( $user ); - /* Note: This is the timestamp saved as hardcoded wikitext to * the database, we use $wgContLang here in order to give * everyone the same signiture and use the default one rather @@ -3156,10 +3148,16 @@ class Parser putenv( 'TZ='.$oldtz ); } + # Signatures + $sigText = $this->getUserSig( $user ); $text = preg_replace( '/~~~~~/', $d, $text ); $text = preg_replace( '/~~~~/', "$sigText $d", $text ); $text = preg_replace( '/~~~/', $sigText, $text ); + # Variable replacement + # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags + $text = $this->replaceVariables( $text ); + # Context links: [[|name]] and [[name (context)|]] # global $wgLegalTitleChars; diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 69705a5f8f..3f803175a4 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -227,8 +227,14 @@ class PreferencesForm { $needRedirect = false; } - # Clean up the signature a little - $this->mNick = Parser::cleanSig( $this->mNick ); + # Validate the signature and clean it up as needed + if( $this->mToggles['fancysig'] ) { + if( Parser::validateSig( $this->mNick ) ) { + $this->mNick = Parser::cleanSig( $this->mNick ); + } else { + $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) ); + } + } $wgUser->setOption( 'language', $this->mUserLanguage ); $wgUser->setOption( 'variant', $this->mUserVariant ); diff --git a/languages/Language.php b/languages/Language.php index 7f4c5c145c..e09b4938dd 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -13,7 +13,7 @@ if( defined( 'MEDIAWIKI' ) ) { # See http://meta.wikipedia.org/wiki/MediaWiki_namespace # # NOTE TO TRANSLATORS: Do not copy this whole file when making translations! -# A lot of common constants and a base class with inheritable methods are +# A lot of common constants and a base class with inheritable mebathods are # defined here, which should not be redefined. See the other LanguageXx.php # files for examples. # @@ -631,7 +631,6 @@ Your account has been created. Don't forget to change your {{SITENAME}} preferen 'yourvariant' => 'Variant', 'yournick' => 'Nickname:', 'badsig' => 'Invalid raw signature; check HTML tags.', -'badsig2' => 'Your signature contains one or more reserved expressions; please remove them.', 'email' => 'E-mail', 'emailforlost' => '
* Optional. An e-mail lets others contact you on this site without revealing your address, and lets us send you a new password if you forget it.

Your real name will be used to give you attribution for your work.
', 'prefs-help-email-enotif' => 'This address is also used to send you e-mail notifications if you enabled the options.', -- 2.20.1