From: Rob Church Date: Mon, 2 Jan 2006 11:42:45 +0000 (+0000) Subject: * (bug 4371) Disallow tilde character in signatures X-Git-Tag: 1.6.0~809 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=415549f294caca02c01fd777fbc53146468d4538;p=lhc%2Fweb%2Fwiklou.git * (bug 4371) Disallow tilde character in signatures --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 98b07fa543..d900df7495 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -389,7 +389,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 4436) Update for Turkish language (tr) * (bug 4413) Update of Farsi language file (LanguageFa.php) * Update for LanguageSr (Serbian): magic words - +* (bug 4371) Disallow tilde character in signatures === Caveats === diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 71f34ca1ae..de9b93bb1f 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -227,6 +227,11 @@ class PreferencesForm { $needRedirect = false; } + if( $this->badNickname() ) { + $this->mainPrefsForm( 'error', wfMsg( 'badsig2' ) ); + return; + } + $wgUser->setOption( 'language', $this->mUserLanguage ); $wgUser->setOption( 'variant', $this->mUserVariant ); $wgUser->setOption( 'nickname', $this->mNick ); @@ -359,6 +364,19 @@ class PreferencesForm { } } } + + /** + * @access private + */ + function badNickname() { + $search = array( '/~~~/', '/~~~~/', '/~~~~~/', '/{{/', '/}}/' ); + foreach( $search as $item ) { + if( preg_match( $item, $this->mNick ) > 0 ) { + return( true ); # We found a reserved expression + } + } + return( false ); + } /** * @access private diff --git a/languages/Language.php b/languages/Language.php index 41579ca62e..28e1801747 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -633,6 +633,7 @@ 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.',