r18220 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18219‎ | r18220 | r18221 >
Date:06:09, 8 December 2006
Author:tstarling
Status:old
Tags:
Comment:
* Added redirect to section feature. Use it wisely.
* Added a configuration variable allowing the "break out of framesets" feature to be switched on and off. Off by default -- there's all sorts of flashy frameset gadgets around, outright abuse is more rare, especially for small default installs.
* Refactored URL fragment handling.
* Made Title::secureAndSplit() slightly more legible.
* Refactored makeGlobalVariablesScript() -- it's not particularly convenient or maintainable to pass all global variables through the template array. The array is there for BC, not flexibility.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -47,9 +47,12 @@
4848 document.write('<link rel="stylesheet" type="text/css" href="'+stylepath+'/'+skin+'/KHTMLFixes.css">');
4949 }
5050 }
51 -// Un-trap us from framesets
52 -if (window.top != window) {
53 - window.top.location = window.location;
 51+
 52+if (wgBreakFrames) {
 53+ // Un-trap us from framesets
 54+ if (window.top != window && wgBreakFramesExceptions.indexOf(window.top.location.hostname) == -1) {
 55+ window.top.location = window.location;
 56+ }
5457 }
5558
5659 // for enhanced RecentChanges
@@ -843,6 +846,18 @@
844847 }
845848 }
846849
 850+function redirectToFragment(fragment) {
 851+ if (is_gecko) {
 852+ // Mozilla needs to wait until after load, otherwise the window doesn't scroll
 853+ addOnloadHook(function () {
 854+ if (window.location.hash == "")
 855+ window.location.hash = fragment;
 856+ });
 857+ } else {
 858+ if (window.location.hash == "")
 859+ window.location.hash = fragment;
 860+ }
 861+}
847862
848863 function runOnloadHook() {
849864 // don't run anything below this for non-dom browsers
Index: trunk/phase3/RELEASE-NOTES
@@ -250,7 +250,11 @@
251251 * Enable QueryPage classes to override list formatting
252252 * (bug 5485) Show number of intervening revisions in diff view
253253 * (bug 8100) Fix XHTML validity in Taiwanese localization
 254+* Added redirect to section feature. Use it wisely.
 255+* Added a configuration variable allowing the "break out of framesets" feature
 256+ to be switched on and off ($wgBreakFrames). Off by default.
254257
 258+
255259 == Languages updated ==
256260
257261 * Bishnupriya Manipuri (bpy)
Index: trunk/phase3/includes/OutputPage.php
@@ -72,6 +72,16 @@
7373 function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); }
7474 function addKeyword( $text ) { array_push( $this->mKeywords, $text ); }
7575 function addScript( $script ) { $this->mScripts .= $script; }
 76+
 77+ /**
 78+ * Add a self-contained script tag with the given contents
 79+ * @param string $script JavaScript text, no <script> tags
 80+ */
 81+ function addInlineScript( $script ) {
 82+ global $wgJsMimeType;
 83+ $this->mScripts .= "<script type=\"$wgJsMimeType\"><!--\n$script\n--></script>";
 84+ }
 85+
7686 function getScript() { return $this->mScripts; }
7787
7888 function setETag($tag) { $this->mETag = $tag; }
Index: trunk/phase3/includes/Title.php
@@ -567,6 +567,19 @@
568568 }
569569 }
570570
 571+ /**
 572+ * Escape a text fragment, say from a link, for a URL
 573+ */
 574+ static function escapeFragmentForURL( $fragment ) {
 575+ $fragment = trim( str_replace( ' ', '_', $fragment ), '_' );
 576+ $fragment = urlencode( Sanitizer::decodeCharReferences( $fragment ) );
 577+ $replaceArray = array(
 578+ '%3A' => ':',
 579+ '%' => '.'
 580+ );
 581+ return strtr( $fragment, $replaceArray );
 582+ }
 583+
571584 #----------------------------------------------------------------------------
572585 # Other stuff
573586 #----------------------------------------------------------------------------
@@ -639,12 +652,25 @@
640653 */
641654 function getInterwiki() { return $this->mInterwiki; }
642655 /**
643 - * Get the Title fragment (i.e. the bit after the #)
 656+ * Get the Title fragment (i.e. the bit after the #) in text form
644657 * @return string
645658 * @access public
646659 */
647660 function getFragment() { return $this->mFragment; }
648661 /**
 662+ * Get the fragment in URL form, including the "#" character if there is one
 663+ *
 664+ * @return string
 665+ * @access public
 666+ */
 667+ function getFragmentForURL() {
 668+ if ( $this->mFragment == '' ) {
 669+ return '';
 670+ } else {
 671+ return '#' . Title::escapeFragmentForURL( $this->mFragment );
 672+ }
 673+ }
 674+ /**
649675 * Get the default namespace index, for when there is no namespace
650676 * @return int
651677 * @access public
@@ -803,9 +829,7 @@
804830 }
805831
806832 # Finally, add the fragment.
807 - if ( '' != $this->mFragment ) {
808 - $url .= '#' . $this->mFragment;
809 - }
 833+ $url .= $this->getFragmentForURL();
810834
811835 wfRunHooks( 'GetFullURL', array( &$this, &$url, $query ) );
812836 return $url;
@@ -1442,41 +1466,41 @@
14431467
14441468 # Clean up whitespace
14451469 #
1446 - $t = preg_replace( '/[ _]+/', '_', $this->mDbkeyform );
1447 - $t = trim( $t, '_' );
 1470+ $dbkey = preg_replace( '/[ _]+/', '_', $this->mDbkeyform );
 1471+ $dbkey = trim( $dbkey, '_' );
14481472
1449 - if ( '' == $t ) {
 1473+ if ( '' == $dbkey ) {
14501474 return false;
14511475 }
14521476
1453 - if( false !== strpos( $t, UTF8_REPLACEMENT ) ) {
 1477+ if( false !== strpos( $dbkey, UTF8_REPLACEMENT ) ) {
14541478 # Contained illegal UTF-8 sequences or forbidden Unicode chars.
14551479 return false;
14561480 }
14571481
1458 - $this->mDbkeyform = $t;
 1482+ $this->mDbkeyform = $dbkey;
14591483
14601484 # Initial colon indicates main namespace rather than specified default
14611485 # but should not create invalid {ns,title} pairs such as {0,Project:Foo}
1462 - if ( ':' == $t{0} ) {
 1486+ if ( ':' == $dbkey{0} ) {
14631487 $this->mNamespace = NS_MAIN;
1464 - $t = substr( $t, 1 ); # remove the colon but continue processing
 1488+ $dbkey = substr( $dbkey, 1 ); # remove the colon but continue processing
14651489 }
14661490
14671491 # Namespace or interwiki prefix
14681492 $firstPass = true;
14691493 do {
14701494 $m = array();
1471 - if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $t, $m ) ) {
 1495+ if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) {
14721496 $p = $m[1];
14731497 $lowerNs = $wgContLang->lc( $p );
14741498 if ( $ns = Namespace::getCanonicalIndex( $lowerNs ) ) {
14751499 # Canonical namespace
1476 - $t = $m[2];
 1500+ $dbkey = $m[2];
14771501 $this->mNamespace = $ns;
14781502 } elseif ( $ns = $wgContLang->getNsIndex( $lowerNs )) {
14791503 # Ordinary namespace
1480 - $t = $m[2];
 1504+ $dbkey = $m[2];
14811505 $this->mNamespace = $ns;
14821506 } elseif( $this->getInterwikiLink( $p ) ) {
14831507 if( !$firstPass ) {
@@ -1486,12 +1510,12 @@
14871511 }
14881512
14891513 # Interwiki link
1490 - $t = $m[2];
 1514+ $dbkey = $m[2];
14911515 $this->mInterwiki = $wgContLang->lc( $p );
14921516
14931517 # Redundant interwiki prefix to the local wiki
14941518 if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) {
1495 - if( $t == '' ) {
 1519+ if( $dbkey == '' ) {
14961520 # Can't have an empty self-link
14971521 return false;
14981522 }
@@ -1503,9 +1527,9 @@
15041528
15051529 # If there's an initial colon after the interwiki, that also
15061530 # resets the default namespace
1507 - if ( $t !== '' && $t[0] == ':' ) {
 1531+ if ( $dbkey !== '' && $dbkey[0] == ':' ) {
15081532 $this->mNamespace = NS_MAIN;
1509 - $t = substr( $t, 1 );
 1533+ $dbkey = substr( $dbkey, 1 );
15101534 }
15111535 }
15121536 # If there's no recognized interwiki or namespace,
@@ -1513,25 +1537,24 @@
15141538 }
15151539 break;
15161540 } while( true );
1517 - $r = $t;
15181541
15191542 # We already know that some pages won't be in the database!
15201543 #
15211544 if ( '' != $this->mInterwiki || NS_SPECIAL == $this->mNamespace ) {
15221545 $this->mArticleID = 0;
15231546 }
1524 - $f = strstr( $r, '#' );
1525 - if ( false !== $f ) {
1526 - $this->mFragment = substr( $f, 1 );
1527 - $r = substr( $r, 0, strlen( $r ) - strlen( $f ) );
 1547+ $fragment = strstr( $dbkey, '#' );
 1548+ if ( false !== $fragment ) {
 1549+ $this->setFragment( $fragment );
 1550+ $dbkey = substr( $dbkey, 0, strlen( $dbkey ) - strlen( $fragment ) );
15281551 # remove whitespace again: prevents "Foo_bar_#"
15291552 # becoming "Foo_bar_"
1530 - $r = preg_replace( '/_*$/', '', $r );
 1553+ $dbkey = preg_replace( '/_*$/', '', $dbkey );
15311554 }
15321555
15331556 # Reject illegal characters.
15341557 #
1535 - if( preg_match( $rxTc, $r ) ) {
 1558+ if( preg_match( $rxTc, $dbkey ) ) {
15361559 return false;
15371560 }
15381561
@@ -1540,19 +1563,26 @@
15411564 * often be unreachable due to the way web browsers deal
15421565 * with 'relative' URLs. Forbid them explicitly.
15431566 */
1544 - if ( strpos( $r, '.' ) !== false &&
1545 - ( $r === '.' || $r === '..' ||
1546 - strpos( $r, './' ) === 0 ||
1547 - strpos( $r, '../' ) === 0 ||
1548 - strpos( $r, '/./' ) !== false ||
1549 - strpos( $r, '/../' ) !== false ) )
 1567+ if ( strpos( $dbkey, '.' ) !== false &&
 1568+ ( $dbkey === '.' || $dbkey === '..' ||
 1569+ strpos( $dbkey, './' ) === 0 ||
 1570+ strpos( $dbkey, '../' ) === 0 ||
 1571+ strpos( $dbkey, '/./' ) !== false ||
 1572+ strpos( $dbkey, '/../' ) !== false ) )
15501573 {
15511574 return false;
15521575 }
15531576
1554 - # We shouldn't need to query the DB for the size.
1555 - #$maxSize = $dbr->textFieldSize( 'page', 'page_title' );
1556 - if ( strlen( $r ) > 255 ) {
 1577+ /**
 1578+ * Limit the size of titles to 255 bytes.
 1579+ * This is typically the size of the underlying database field.
 1580+ * We make an exception for special pages, which don't need to be stored
 1581+ * in the database, and may edge over 255 bytes due to subpage syntax
 1582+ * for long titles, e.g. [[Special:Block/Long name]]
 1583+ */
 1584+ if ( ( $this->mNamespace != NS_SPECIAL && strlen( $dbkey ) > 255 ) ||
 1585+ strlen( $dbkey ) > 512 )
 1586+ {
15571587 return false;
15581588 }
15591589
@@ -1565,9 +1595,7 @@
15661596 * site might be case-sensitive.
15671597 */
15681598 if( $wgCapitalLinks && $this->mInterwiki == '') {
1569 - $t = $wgContLang->ucfirst( $r );
1570 - } else {
1571 - $t = $r;
 1599+ $dbkey = $wgContLang->ucfirst( $dbkey );
15721600 }
15731601
15741602 /**
@@ -1575,27 +1603,40 @@
15761604 * "empty" local links can only be self-links
15771605 * with a fragment identifier.
15781606 */
1579 - if( $t == '' &&
 1607+ if( $dbkey == '' &&
15801608 $this->mInterwiki == '' &&
15811609 $this->mNamespace != NS_MAIN ) {
15821610 return false;
15831611 }
15841612
15851613 // Any remaining initial :s are illegal.
1586 - if ( $t !== '' && ':' == $t{0} ) {
 1614+ if ( $dbkey !== '' && ':' == $dbkey{0} ) {
15871615 return false;
15881616 }
15891617
15901618 # Fill fields
1591 - $this->mDbkeyform = $t;
1592 - $this->mUrlform = wfUrlencode( $t );
 1619+ $this->mDbkeyform = $dbkey;
 1620+ $this->mUrlform = wfUrlencode( $dbkey );
15931621
1594 - $this->mTextform = str_replace( '_', ' ', $t );
 1622+ $this->mTextform = str_replace( '_', ' ', $dbkey );
15951623
15961624 return true;
15971625 }
15981626
15991627 /**
 1628+ * Set the fragment for this title
 1629+ * This is kind of bad, since except for this rarely-used function, Title objects
 1630+ * are immutable. The reason this is here is because it's better than setting the
 1631+ * members directly, which is what Linker::formatComment was doing previously.
 1632+ *
 1633+ * @param string $fragment text
 1634+ * @access kind of public
 1635+ */
 1636+ function setFragment( $fragment ) {
 1637+ $this->mFragment = trim( str_replace( '_', ' ', substr( $fragment, 1 ) ), ' ' );
 1638+ }
 1639+
 1640+ /**
16001641 * Get a Title object associated with the talk page of this article
16011642 * @return Title the object for the talk page
16021643 * @access public
Index: trunk/phase3/includes/Xml.php
@@ -255,6 +255,33 @@
256256 }
257257
258258 /**
 259+ * Encode a variable of unknown type to JavaScript.
 260+ * Doesn't support hashtables just yet.
 261+ */
 262+ public static function encodeJsVar( $value ) {
 263+ if ( is_bool( $value ) ) {
 264+ $s = $value ? 'true' : 'false';
 265+ } elseif ( is_null( $value ) ) {
 266+ $s = 'null';
 267+ } elseif ( is_int( $value ) ) {
 268+ $s = $value;
 269+ } elseif ( is_array( $value ) ) {
 270+ $s = '[';
 271+ foreach ( $value as $name => $elt ) {
 272+ if ( $s != '[' ) {
 273+ $s .= ', ';
 274+ }
 275+ $s .= self::encodeJsVar( $elt );
 276+ }
 277+ $s .= ']';
 278+ } else {
 279+ $s = '"' . self::escapeJsString( $value ) . '"';
 280+ }
 281+ return $s;
 282+ }
 283+
 284+
 285+ /**
259286 * Check if a string is well-formed XML.
260287 * Must include the surrounding tag.
261288 *
Index: trunk/phase3/includes/Linker.php
@@ -213,22 +213,6 @@
214214 $trail = $m[2];
215215 }
216216 }
217 -
218 - # Check for anchors, normalize the anchor
219 -
220 - $parts = explode( '#', $u, 2 );
221 - if ( count( $parts ) == 2 ) {
222 - $anchor = urlencode( Sanitizer::decodeCharReferences( str_replace(' ', '_', $parts[1] ) ) );
223 - $replacearray = array(
224 - '%3A' => ':',
225 - '%' => '.'
226 - );
227 - $u = $parts[0] . '#' .
228 - str_replace( array_keys( $replacearray ),
229 - array_values( $replacearray ),
230 - $anchor );
231 - }
232 -
233217 $t = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>";
234218
235219 wfProfileOut( $fname );
@@ -307,12 +291,7 @@
308292 $text = htmlspecialchars( $nt->getFragment() );
309293 }
310294 }
311 - $anchor = urlencode( Sanitizer::decodeCharReferences( str_replace( ' ', '_', $nt->getFragment() ) ) );
312 - $replacearray = array(
313 - '%3A' => ':',
314 - '%' => '.'
315 - );
316 - $u .= '#' . str_replace(array_keys($replacearray),array_values($replacearray),$anchor);
 295+ $u .= $nt->getFragmentForURL();
317296 }
318297 if ( $text == '' ) {
319298 $text = htmlspecialchars( $nt->getPrefixedText() );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2334,4 +2334,18 @@
23352335 "$IP/maintenance/parserTests.txt",
23362336 );
23372337
 2338+/**
 2339+ * Break out of framesets. This can be used to prevent external sites from
 2340+ * framing your site with ads.
 2341+ */
 2342+$wgBreakFrames = false;
 2343+
 2344+/**
 2345+ * Break frameset exception list
 2346+ */
 2347+$wgBreakFramesExceptions = array(
 2348+ 'babelfish.altavista.com',
 2349+ 'translate.google.com',
 2350+);
 2351+
23382352 ?>
Index: trunk/phase3/includes/Skin.php
@@ -270,61 +270,62 @@
271271 $out->out( "\n</body></html>" );
272272 }
273273
274 - static function makeGlobalVariablesScript( $data ) {
275 - $r = '<script type= "' . $data['jsmimetype'] . '">
276 - var skin = "' . Xml::escapeJsString( $data['skinname'] ) . '";
277 - var stylepath = "' . Xml::escapeJsString( $data['stylepath'] ) . '";
 274+ static function makeVariablesScript( $data ) {
 275+ global $wgJsMimeType;
278276
279 - var wgArticlePath = "' . Xml::escapeJsString( $data['articlepath'] ) . '";
280 - var wgScriptPath = "' . Xml::escapeJsString( $data['scriptpath'] ) . '";
281 - var wgServer = "' . Xml::escapeJsString( $data['serverurl'] ) . '";
 277+ $r = "<script type= \"$wgJsMimeType\"><!--\n";
 278+ foreach ( $data as $name => $value ) {
 279+ $encValue = Xml::encodeJsVar( $value );
 280+ $r .= "var $name = $encValue;\n";
 281+ }
 282+ $r .= "--></script>\n";
282283
283 - var wgCanonicalNamespace = "' . Xml::escapeJsString( $data['nscanonical'] ) . '";
284 - var wgNamespaceNumber = ' . (int)$data['nsnumber'] . ';
285 - var wgPageName = "' . Xml::escapeJsString( $data['titleprefixeddbkey'] ) . '";
286 - var wgTitle = "' . Xml::escapeJsString( $data['titletext'] ) . '";
287 - var wgArticleId = ' . (int)$data['articleid'] . ';
288 - var wgCurRevisionId = ' . ( int ) $data['currevisionid'] . ';
289 - var wgIsArticle = ' . ( $data['isarticle'] ? 'true' : 'false' ) . ';
290 -
291 - var wgUserName = ' . ( $data['username'] == NULL ? 'null' : ( '"' . Xml::escapeJsString( $data['username'] ) . '"' ) ) . ';
292 - var wgUserLanguage = "' . Xml::escapeJsString( $data['userlang'] ) . '";
293 - var wgContentLanguage = "' . Xml::escapeJsString( $data['lang'] ) . '";
294 - </script>
295 - ';
296 -
297284 return $r;
298285 }
299286
300 - function getHeadScripts() {
301 - global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType, $wgStyleVersion;
 287+ /**
 288+ * Make a <script> tag containing global variables
 289+ * @param array $data Associative array containing one element:
 290+ * skinname => the skin name
 291+ * The odd calling convention is for backwards compatibility
 292+ */
 293+ static function makeGlobalVariablesScript( $data ) {
 294+ global $wgStylePath, $wgUser;
302295 global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
303296 global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
 297+ global $wgBreakFrames, $wgBreakFramesExceptions;
304298
305299 $ns = $wgTitle->getNamespace();
306300 $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
307301
308302 $vars = array(
309 - 'jsmimetype' => $wgJsMimeType,
310 - 'skinname' => $this->getSkinName(),
 303+ 'skin' => $data['skinname'],
311304 'stylepath' => $wgStylePath,
312 - 'articlepath' => $wgArticlePath,
313 - 'scriptpath' => $wgScriptPath,
314 - 'serverurl' => $wgServer,
315 - 'nscanonical' => $nsname,
316 - 'nsnumber' => $wgTitle->getNamespace(),
317 - 'titleprefixeddbkey' => $wgTitle->getPrefixedDBKey(),
318 - 'titletext' => $wgTitle->getText(),
319 - 'articleid' => $wgTitle->getArticleId(),
320 - 'currevisionid' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0,
321 - 'isarticle' => $wgOut->isArticle(),
322 - 'username' => $wgUser->isAnon() ? NULL : $wgUser->getName(),
323 - 'userlang' => $wgLang->getCode(),
324 - 'lang' => $wgContLang->getCode(),
 305+ 'wgArticlePath' => $wgArticlePath,
 306+ 'wgScriptPath' => $wgScriptPath,
 307+ 'wgServer' => $wgServer,
 308+ 'wgCanonicalNamespace' => $nsname,
 309+ 'wgNamespaceNumber' => $wgTitle->getNamespace(),
 310+ 'wgPageName' => $wgTitle->getPrefixedDBKey(),
 311+ 'wgTitle' => $wgTitle->getText(),
 312+ 'wgArticleId' => $wgTitle->getArticleId(),
 313+ 'wgIsArticle' => $wgOut->isArticle(),
 314+ 'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(),
 315+ 'wgUserLanguage' => $wgLang->getCode(),
 316+ 'wgContentLanguage' => $wgContLang->getCode(),
 317+ 'wgBreakFrames' => $wgBreakFrames,
 318+ 'wgBreakFramesExceptions' => $wgBreakFramesExceptions,
 319+ 'wgCurRevisionId' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0,
325320 );
326321
327 - $r = self::makeGlobalVariablesScript( $vars );
 322+ return self::makeVariablesScript( $vars );
 323+ }
328324
 325+ function getHeadScripts() {
 326+ global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType, $wgStyleVersion;
 327+
 328+ $r = self::makeGlobalVariablesScript( array( 'skinname' => $this->getSkinName() ) );
 329+
329330 $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
330331 global $wgUseSiteJs;
331332 if ($wgUseSiteJs) {
Index: trunk/phase3/includes/Article.php
@@ -691,6 +691,12 @@
692692 $redir = $sk->makeKnownLinkObj( $this->mRedirectedFrom, '', 'redirect=no' );
693693 $s = wfMsg( 'redirectedfrom', $redir );
694694 $wgOut->setSubtitle( $s );
 695+
 696+ // Set the fragment if one was specified in the redirect
 697+ if ( strval( $this->mTitle->getFragment() ) != '' ) {
 698+ $fragment = Xml::escapeJsString( $this->mTitle->getFragmentForURL() );
 699+ $wgOut->addInlineScript( "redirectToFragment(\"$fragment\");" );
 700+ }
695701 $wasRedirected = true;
696702 }
697703 } elseif ( !empty( $rdfrom ) ) {
@@ -778,7 +784,7 @@
779785 if( !$wasRedirected && $this->isCurrent() ) {
780786 $wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) );
781787 }
782 - $link = $sk->makeLinkObj( $rt );
 788+ $link = $sk->makeLinkObj( $rt, $rt->getFullText() );
783789
784790 $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
785791 '<span class="redirectText">'.$link.'</span>' );
@@ -2666,7 +2672,7 @@
26672673 public static function getRedirectAutosummary( $text ) {
26682674 $rt = Title::newFromRedirect( $text );
26692675 if( is_object( $rt ) )
2670 - return wfMsgForContent( 'autoredircomment', $rt->getPrefixedText() );
 2676+ return wfMsgForContent( 'autoredircomment', $rt->getFullText() );
26712677 else
26722678 return '';
26732679 }