r29210 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29209‎ | r29210 | r29211 >
Date:10:52, 3 January 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Allow user: and user_talk links
* Fix escaping
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageChecks.php
@@ -27,15 +27,15 @@
2828 }
2929
3030 if ( count($values = self::checkBalance( $message )) ) {
31 - $warnings[] = wfMsgExt( self::MSG . 'balance', 'parse', implode( ', ', $values ) );
 31+ $warnings[] = wfMsgExt( self::MSG . 'balance', 'parse', wfEscapeWikiText( implode( ', ', $values ) ) );
3232 }
3333
3434 if ( count($values = self::checkLinks( $message )) ) {
35 - $warnings[] = wfMsgExt( self::MSG . 'links', 'parse', implode( ', ', $values ) );
 35+ $warnings[] = wfMsgExt( self::MSG . 'links', 'parse', wfEscapeWikiText( implode( ', ', $values ) ) );
3636 }
3737
3838 if ( count($values = self::checkXHTML( $message )) ) {
39 - $warnings[] = wfMsgExt( self::MSG . 'xhtml', 'parse', implode( ', ', $values ) );
 39+ $warnings[] = wfMsgExt( self::MSG . 'xhtml', 'parse', htmlspecialchars( implode( ', ', $values ) ) );
4040 }
4141
4242 if ( self::checkPlural( $message ) ) {
@@ -107,6 +107,7 @@
108108 for ($i = 0; $i < count($matches[0]); $i++ ) {
109109 if ( preg_match( '/({{ns:)?special(}})?:.*/sDui', $matches[1][$i] ) ) continue;
110110 if ( preg_match( '/{{mediawiki:.*}}/sDui', $matches[1][$i] ) ) continue;
 111+ if ( preg_match( '/user([ _]talk)?:.*/sDui', $matches[1][$i] ) ) continue;
111112
112113 $links[] = "[[{$matches[1][$i]}|{$matches[2][$i]}]]";
113114 }
@@ -136,7 +137,7 @@
137138 $matches = array();
138139 preg_match_all( $wrong, $translation, $matches, PREG_PATTERN_ORDER);
139140 foreach ( $matches[0] as $wrongMatch ) {
140 - $wrongTags[$wrongMatch] = htmlspecialchars( "$wrongMatch → $correct" );
 141+ $wrongTags[$wrongMatch] = "$wrongMatch → $correct";
141142 }
142143 }
143144 return $wrongTags;

Status & tagging log