r90482 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90481‎ | r90482 | r90483 >
Date:19:45, 20 June 2011
Author:mgrabovsky
Status:ok (Comments)
Tags:
Comment:
Follow-up r90371, per comment by ^demon

Escape wikitext in username before passing it to certain messages; also remove <nowiki>s in those as they're superfluous.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)
  • /trunk/phase3/includes/actions/DeleteAction.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlock.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProtectionForm.php
@@ -237,7 +237,8 @@
238238 $wgOut->showPermissionsErrorPage( $this->mPermErrors );
239239 }
240240 } else {
241 - $wgOut->addWikiMsg( 'protect-text', $this->mTitle->getPrefixedText() );
 241+ $wgOut->addWikiMsg( 'protect-text',
 242+ wfEscapeWikiText( $this->mTitle->getPrefixedText() ) );
242243 }
243244
244245 $wgOut->addHTML( $this->buildForm() );
Index: trunk/phase3/includes/Article.php
@@ -1439,7 +1439,7 @@
14401440
14411441 if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
14421442 $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1443 - array( 'userpage-userdoesnotexist-view', $rootPart ) );
 1443+ array( 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ) );
14441444 } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
14451445 LogEventsList::showLogExtract(
14461446 $wgOut,
@@ -2732,7 +2732,8 @@
27332733 Html::rawElement(
27342734 'div',
27352735 array( 'class' => 'error mw-error-cannotdelete' ),
2736 - wfMsgExt( 'cannotdelete', array( 'parse' ), $this->mTitle->getPrefixedText() )
 2736+ wfMsgExt( 'cannotdelete', array( 'parse' ),
 2737+ wfEscapeWikiText( $this->mTitle->getPrefixedText() ) )
27372738 )
27382739 );
27392740 $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
@@ -3000,7 +3001,7 @@
30013002
30023003 $loglink = '[[Special:Log/delete|' . wfMsgNoTrans( 'deletionlog' ) . ']]';
30033004
3004 - $wgOut->addWikiMsg( 'deletedtext', $deleted, $loglink );
 3005+ $wgOut->addWikiMsg( 'deletedtext', wfEscapeWikiText( $deleted ), $loglink );
30053006 $wgOut->returnToMain( false );
30063007 } else {
30073008 if ( $error == '' ) {
@@ -3008,7 +3009,8 @@
30093010 Html::rawElement(
30103011 'div',
30113012 array( 'class' => 'error mw-error-cannotdelete' ),
3012 - wfMsgExt( 'cannotdelete', array( 'parse' ), $this->mTitle->getPrefixedText() )
 3013+ wfMsgExt( 'cannotdelete', array( 'parse' ),
 3014+ wfEscapeWikiText( $this->mTitle->getPrefixedText() ) )
30133015 )
30143016 );
30153017
Index: trunk/phase3/includes/EditPage.php
@@ -792,7 +792,7 @@
793793 $ip = User::isIP( $username );
794794 if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
795795 $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
796 - array( 'userpage-userdoesnotexist', $username ) );
 796+ array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
797797 } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
798798 LogEventsList::showLogExtract(
799799 $wgOut,
Index: trunk/phase3/includes/actions/DeleteAction.php
@@ -204,7 +204,7 @@
205205 $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) );
206206 $this->getOutput()->addWikiMsg(
207207 'deletedtext',
208 - $this->getTitle()->getPrefixedText(),
 208+ wfEscapeWikiText( $this->getTitle()->getPrefixedText() ),
209209 '[[Special:Log/delete|' . wfMsgNoTrans( 'deletionlog' ) . ']]'
210210 );
211211 $this->getOutput()->returnToMain( false );
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -696,9 +696,11 @@
697697 break;
698698 case self::NOT_EXISTS:
699699 if( $wgUser->isAllowed( 'createaccount' ) ) {
700 - $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $this->mUsername ) );
 700+ $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline',
 701+ wfEscapeWikiText( $this->mUsername ) ) );
701702 } else {
702 - $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mUsername ) ) );
 703+ $this->mainLoginForm( wfMsg( 'nosuchusershort',
 704+ wfEscapeWikiText( $this->mUsername ) ) );
703705 }
704706 break;
705707 case self::WRONG_PASS:
Index: trunk/phase3/includes/specials/SpecialBlock.php
@@ -486,7 +486,8 @@
487487 if( $type == Block::TYPE_USER ){
488488 # TODO: why do we not have a User->exists() method?
489489 if( !$target->getId() ){
490 - return wfMessage( 'nosuchusershort', $target->getName() );
 490+ return wfMessage( 'nosuchusershort',
 491+ wfEscapeWikiText( $target->getName() ) );
491492 }
492493
493494 $status = self::checkUnblockSelf( $target );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1090,7 +1090,7 @@
10911091 'nosuchuser' => 'There is no user by the name "$1".
10921092 Usernames are case sensitive.
10931093 Check your spelling, or [[Special:UserLogin/signup|create a new account]].',
1094 -'nosuchusershort' => 'There is no user by the name "<nowiki>$1</nowiki>".
 1094+'nosuchusershort' => 'There is no user by the name "$1".
10951095 Check your spelling.',
10961096 'nouserspecified' => 'You have to specify a username.',
10971097 'login-userblocked' => 'This user is blocked. Login not allowed.',
@@ -1319,9 +1319,9 @@
13201320 You can [[Special:Search/{{PAGENAME}}|search for this page title]] in other pages,
13211321 or <span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} search the related logs]</span>.',
13221322 'noarticletextanon' => '{{int:noarticletext}}', # do not translate or duplicate this message to other languages
1323 -'userpage-userdoesnotexist' => 'User account "<nowiki>$1</nowiki>" is not registered.
 1323+'userpage-userdoesnotexist' => 'User account "$1" is not registered.
13241324 Please check if you want to create/edit this page.',
1325 -'userpage-userdoesnotexist-view' => 'User account "<nowiki>$1</nowiki>" is not registered.',
 1325+'userpage-userdoesnotexist-view' => 'User account "$1" is not registered.',
13261326 'blocked-notice-logextract' => 'This user is currently blocked.
13271327 The latest block log entry is provided below for reference:',
13281328 'clearyourcache' => "'''Note: After saving, you may have to bypass your browser's cache to see the changes.'''
@@ -2797,7 +2797,7 @@
27982798 Please confirm that you intend to do this, that you understand the consequences, and that you are doing this in accordance with [[{{MediaWiki:Policy-url}}|the policy]].',
27992799 'actioncomplete' => 'Action complete',
28002800 'actionfailed' => 'Action failed',
2801 -'deletedtext' => '"<nowiki>$1</nowiki>" has been deleted.
 2801+'deletedtext' => '"$1" has been deleted.
28022802 See $2 for a record of recent deletions.',
28032803 'deletedarticle' => 'deleted "[[$1]]"',
28042804 'suppressedarticle' => 'suppressed "[[$1]]"',
@@ -2859,7 +2859,7 @@
28602860 'protect_expiry_invalid' => 'Expiry time is invalid.',
28612861 'protect_expiry_old' => 'Expiry time is in the past.',
28622862 'protect-unchain-permissions' => 'Unlock further protect options',
2863 -'protect-text' => "You may view and change the protection level here for the page '''<nowiki>$1</nowiki>'''.",
 2863+'protect-text' => "You may view and change the protection level here for the page '''$1'''.",
28642864 'protect-locked-blocked' => "You cannot change protection levels while blocked.
28652865 Here are the current settings for the page '''$1''':",
28662866 'protect-locked-dblock' => "Protection levels cannot be changed due to an active database lock.

Follow-up revisions

RevisionCommit summaryAuthorDate
r90588Follow-up r90482: escape some more wikitextmgrabovsky14:59, 22 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90371(bug 29437) Multiple apostrophes in deleted article title cause odd rendering...mgrabovsky21:57, 18 June 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   22:05, 4 August 2011

Some double encoding here too. wfMsgExt with 'parse' encodes them already.

#Comment by Aaron Schulz (talk | contribs)   21:45, 1 September 2011

Re-reviewing as with previous r90588 commit. This is actually OK.

Status & tagging log