r12489 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12488‎ | r12489 | r12490 >
Date:23:37, 7 January 2006
Author:robchurch
Status:old
Tags:
Comment:
* 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
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3133,14 +3133,6 @@
31343134 function pstPass2( $text, &$user ) {
31353135 global $wgContLang, $wgLocaltimezone;
31363136
3137 - # Variable replacement
3138 - # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
3139 - $text = $this->replaceVariables( $text );
3140 -
3141 - # Signatures
3142 - #
3143 - $sigText = $this->getUserSig( $user );
3144 -
31453137 /* Note: This is the timestamp saved as hardcoded wikitext to
31463138 * the database, we use $wgContLang here in order to give
31473139 * everyone the same signiture and use the default one rather
@@ -3156,10 +3148,16 @@
31573149 putenv( 'TZ='.$oldtz );
31583150 }
31593151
 3152+ # Signatures
 3153+ $sigText = $this->getUserSig( $user );
31603154 $text = preg_replace( '/~~~~~/', $d, $text );
31613155 $text = preg_replace( '/~~~~/', "$sigText $d", $text );
31623156 $text = preg_replace( '/~~~/', $sigText, $text );
31633157
 3158+ # Variable replacement
 3159+ # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
 3160+ $text = $this->replaceVariables( $text );
 3161+
31643162 # Context links: [[|name]] and [[name (context)|]]
31653163 #
31663164 global $wgLegalTitleChars;
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -227,8 +227,14 @@
228228 $needRedirect = false;
229229 }
230230
231 - # Clean up the signature a little
232 - $this->mNick = Parser::cleanSig( $this->mNick );
 231+ # Validate the signature and clean it up as needed
 232+ if( $this->mToggles['fancysig'] ) {
 233+ if( Parser::validateSig( $this->mNick ) ) {
 234+ $this->mNick = Parser::cleanSig( $this->mNick );
 235+ } else {
 236+ $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
 237+ }
 238+ }
233239
234240 $wgUser->setOption( 'language', $this->mUserLanguage );
235241 $wgUser->setOption( 'variant', $this->mUserVariant );
Index: trunk/phase3/languages/Language.php
@@ -13,7 +13,7 @@
1414 # See http://meta.wikipedia.org/wiki/MediaWiki_namespace
1515 #
1616 # NOTE TO TRANSLATORS: Do not copy this whole file when making translations!
17 -# A lot of common constants and a base class with inheritable methods are
 17+# A lot of common constants and a base class with inheritable mebathods are
1818 # defined here, which should not be redefined. See the other LanguageXx.php
1919 # files for examples.
2020 #
@@ -631,7 +631,6 @@
632632 'yourvariant' => 'Variant',
633633 'yournick' => 'Nickname:',
634634 'badsig' => 'Invalid raw signature; check HTML tags.',
635 -'badsig2' => 'Your signature contains one or more reserved expressions; please remove them.',
636635 'email' => 'E-mail',
637636 'emailforlost' => '<div style="width:30em">* 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.<br /><br />Your real name will be used to give you attribution for your work.</div>',
638637 'prefs-help-email-enotif' => 'This address is also used to send you e-mail notifications if you enabled the options.',

Status & tagging log