* (bug 4371) Disallow tilde character in signatures
authorRob Church <robchurch@users.mediawiki.org>
Mon, 2 Jan 2006 11:42:45 +0000 (11:42 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 2 Jan 2006 11:42:45 +0000 (11:42 +0000)
RELEASE-NOTES
includes/SpecialPreferences.php
languages/Language.php

index 98b07fa..d900df7 100644 (file)
@@ -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 ===
 
index 71f34ca..de9b93b 100644 (file)
@@ -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
index 41579ca..28e1801 100644 (file)
@@ -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' => '<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>',
 'prefs-help-email-enotif' => 'This address is also used to send you e-mail notifications if you enabled the options.',