From a6728ea575fa3c1411c22d7ceb7b304bae534ab2 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 12 Jan 2006 22:38:55 +0000 Subject: [PATCH] Remove hack from signature clean-up code; implement the clean-up properly within preferences --- includes/Parser.php | 11 ++++------- includes/SpecialPreferences.php | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 56f62caa3d..8776b058f6 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3236,7 +3236,7 @@ class Parser # Sig. might contain markup; validate this if( $this->validateSig( $nickname ) !== false ) { # Validated; clean up (if needed) and return it - return( $this->cleanSig( $nickname, true ) ); + return( $this->cleanSig( $nickname ) ); } else { # Failed to validate; fall back to the default $nickname = $username; @@ -3269,7 +3269,8 @@ class Parser * @param string $text * @return string Text */ - function cleanSig( $text, $parsing = false ) { + function cleanSig( $text ) { + $mw = MagicWord::get( MAG_SUBST ); $substre = $mw->getBaseRegex(); $subst = $mw->getSynonym( 0 ); @@ -3289,11 +3290,7 @@ class Parser ); $text = preg_replace( '/~{3,5}/', '', $text ); - - # TODO: Fix this, it's an ugly hack - if( $parsing ) { - $text = $this->replaceVariables( $text ); - } + $text = $this->replaceVariables( $text ); return $text; } diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 7a2e76d0b1..23e476eafe 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -190,7 +190,7 @@ class PreferencesForm { * @access private */ function savePreferences() { - global $wgUser, $wgLang, $wgOut; + global $wgUser, $wgLang, $wgOut, $wgParser; global $wgEnableUserEmail, $wgEnableEmail; global $wgEmailAuthentication, $wgMinimalPasswordLength; global $wgAuth; @@ -230,7 +230,7 @@ class PreferencesForm { # Validate the signature and clean it up as needed if( $this->mToggles['fancysig'] ) { if( Parser::validateSig( $this->mNick ) !== false ) { - $this->mNick = Parser::cleanSig( $this->mNick ); + $this->mNick = $wgParser->cleanSig( $this->mNick ); } else { $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) ); } -- 2.20.1