r12348 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12347‎ | r12348 | r12349 >
Date:11:42, 2 January 2006
Author:robchurch
Status:old
Tags:
Comment:
* (bug 4371) Disallow tilde character in signatures
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPreferences.php
@@ -227,6 +227,11 @@
228228 $needRedirect = false;
229229 }
230230
 231+ if( $this->badNickname() ) {
 232+ $this->mainPrefsForm( 'error', wfMsg( 'badsig2' ) );
 233+ return;
 234+ }
 235+
231236 $wgUser->setOption( 'language', $this->mUserLanguage );
232237 $wgUser->setOption( 'variant', $this->mUserVariant );
233238 $wgUser->setOption( 'nickname', $this->mNick );
@@ -359,6 +364,19 @@
360365 }
361366 }
362367 }
 368+
 369+ /**
 370+ * @access private
 371+ */
 372+ function badNickname() {
 373+ $search = array( '/~~~/', '/~~~~/', '/~~~~~/', '/{{/', '/}}/' );
 374+ foreach( $search as $item ) {
 375+ if( preg_match( $item, $this->mNick ) > 0 ) {
 376+ return( true ); # We found a reserved expression
 377+ }
 378+ }
 379+ return( false );
 380+ }
363381
364382 /**
365383 * @access private
Index: trunk/phase3/RELEASE-NOTES
@@ -389,8 +389,8 @@
390390 * (bug 4436) Update for Turkish language (tr)
391391 * (bug 4413) Update of Farsi language file (LanguageFa.php)
392392 * Update for LanguageSr (Serbian): magic words
 393+* (bug 4371) Disallow tilde character in signatures
393394
394 -
395395 === Caveats ===
396396
397397 Some output, particularly involving user-supplied inline HTML, may not
Index: trunk/phase3/languages/Language.php
@@ -633,6 +633,7 @@
634634 'yourvariant' => 'Variant',
635635 'yournick' => 'Nickname:',
636636 'badsig' => 'Invalid raw signature; check HTML tags.',
 637+'badsig2' => 'Your signature contains one or more reserved expressions; please remove them.',
637638 'email' => 'E-mail',
638639 '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>',
639640 'prefs-help-email-enotif' => 'This address is also used to send you e-mail notifications if you enabled the options.',

Status & tagging log