Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -2260,6 +2260,17 @@ |
2261 | 2261 | !! end |
2262 | 2262 | |
2263 | 2263 | !! test |
| 2264 | +Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) |
| 2265 | +!! options |
| 2266 | +title=[[*RFC 1234 http://example.com/]] |
| 2267 | +!! input |
| 2268 | +{{PAGENAMEE}} |
| 2269 | +!! result |
| 2270 | +<p>*RFC_1234_http://example.com/ |
| 2271 | +</p> |
| 2272 | +!! end |
| 2273 | + |
| 2274 | +!! test |
2264 | 2275 | Magic Word: {{REVISIONID}} |
2265 | 2276 | !! input |
2266 | 2277 | {{REVISIONID}} |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2593,25 +2593,25 @@ |
2594 | 2594 | $value = wfEscapeWikiText( $this->mTitle->getText() ); |
2595 | 2595 | break; |
2596 | 2596 | case 'pagenamee': |
2597 | | - $value = $this->mTitle->getPartialURL(); |
| 2597 | + $value = wfEscapeWikiText( $this->mTitle->getPartialURL() ); |
2598 | 2598 | break; |
2599 | 2599 | case 'fullpagename': |
2600 | 2600 | $value = wfEscapeWikiText( $this->mTitle->getPrefixedText() ); |
2601 | 2601 | break; |
2602 | 2602 | case 'fullpagenamee': |
2603 | | - $value = $this->mTitle->getPrefixedURL(); |
| 2603 | + $value = wfEscapeWikiText( $this->mTitle->getPrefixedURL() ); |
2604 | 2604 | break; |
2605 | 2605 | case 'subpagename': |
2606 | 2606 | $value = wfEscapeWikiText( $this->mTitle->getSubpageText() ); |
2607 | 2607 | break; |
2608 | 2608 | case 'subpagenamee': |
2609 | | - $value = $this->mTitle->getSubpageUrlForm(); |
| 2609 | + $value = wfEscapeWikiText( $this->mTitle->getSubpageUrlForm() ); |
2610 | 2610 | break; |
2611 | 2611 | case 'basepagename': |
2612 | 2612 | $value = wfEscapeWikiText( $this->mTitle->getBaseText() ); |
2613 | 2613 | break; |
2614 | 2614 | case 'basepagenamee': |
2615 | | - $value = wfUrlEncode( str_replace( ' ', '_', $this->mTitle->getBaseText() ) ); |
| 2615 | + $value = wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $this->mTitle->getBaseText() ) ) ); |
2616 | 2616 | break; |
2617 | 2617 | case 'talkpagename': |
2618 | 2618 | if ( $this->mTitle->canTalk() ) { |
— | — | @@ -2624,7 +2624,7 @@ |
2625 | 2625 | case 'talkpagenamee': |
2626 | 2626 | if ( $this->mTitle->canTalk() ) { |
2627 | 2627 | $talkPage = $this->mTitle->getTalkPage(); |
2628 | | - $value = $talkPage->getPrefixedUrl(); |
| 2628 | + $value = wfEscapeWikiText( $talkPage->getPrefixedUrl() ); |
2629 | 2629 | } else { |
2630 | 2630 | $value = ''; |
2631 | 2631 | } |
— | — | @@ -2635,7 +2635,7 @@ |
2636 | 2636 | break; |
2637 | 2637 | case 'subjectpagenamee': |
2638 | 2638 | $subjPage = $this->mTitle->getSubjectPage(); |
2639 | | - $value = $subjPage->getPrefixedUrl(); |
| 2639 | + $value = wfEscapeWikiText( $subjPage->getPrefixedUrl() ); |
2640 | 2640 | break; |
2641 | 2641 | case 'revisionid': |
2642 | 2642 | # Let the edit saving system know we should parse the page |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -409,7 +409,7 @@ |
410 | 410 | $t = Title::newFromText( $title ); |
411 | 411 | if ( is_null( $t ) ) |
412 | 412 | return ''; |
413 | | - return $t->getPartialURL(); |
| 413 | + return wfEscapeWikiText( $t->getPartialURL() ); |
414 | 414 | } |
415 | 415 | static function fullpagename( $parser, $title = null ) { |
416 | 416 | $t = Title::newFromText( $title ); |
— | — | @@ -421,31 +421,31 @@ |
422 | 422 | $t = Title::newFromText( $title ); |
423 | 423 | if ( is_null( $t ) || !$t->canTalk() ) |
424 | 424 | return ''; |
425 | | - return $t->getPrefixedURL(); |
| 425 | + return wfEscapeWikiText( $t->getPrefixedURL() ); |
426 | 426 | } |
427 | 427 | static function subpagename( $parser, $title = null ) { |
428 | 428 | $t = Title::newFromText( $title ); |
429 | 429 | if ( is_null( $t ) ) |
430 | 430 | return ''; |
431 | | - return $t->getSubpageText(); |
| 431 | + return wfEscapeWikiText( $t->getSubpageText() ); |
432 | 432 | } |
433 | 433 | static function subpagenamee( $parser, $title = null ) { |
434 | 434 | $t = Title::newFromText( $title ); |
435 | 435 | if ( is_null( $t ) ) |
436 | 436 | return ''; |
437 | | - return $t->getSubpageUrlForm(); |
| 437 | + return wfEscapeWikiText( $t->getSubpageUrlForm() ); |
438 | 438 | } |
439 | 439 | static function basepagename( $parser, $title = null ) { |
440 | 440 | $t = Title::newFromText( $title ); |
441 | 441 | if ( is_null( $t ) ) |
442 | 442 | return ''; |
443 | | - return $t->getBaseText(); |
| 443 | + return wfEscapeWikiText( $t->getBaseText() ); |
444 | 444 | } |
445 | 445 | static function basepagenamee( $parser, $title = null ) { |
446 | 446 | $t = Title::newFromText( $title ); |
447 | 447 | if ( is_null( $t ) ) |
448 | 448 | return ''; |
449 | | - return wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ); |
| 449 | + return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) ); |
450 | 450 | } |
451 | 451 | static function talkpagename( $parser, $title = null ) { |
452 | 452 | $t = Title::newFromText( $title ); |
— | — | @@ -457,7 +457,7 @@ |
458 | 458 | $t = Title::newFromText( $title ); |
459 | 459 | if ( is_null( $t ) || !$t->canTalk() ) |
460 | 460 | return ''; |
461 | | - return $t->getTalkPage()->getPrefixedUrl(); |
| 461 | + return wfEscapeWikiText( $t->getTalkPage()->getPrefixedUrl() ); |
462 | 462 | } |
463 | 463 | static function subjectpagename( $parser, $title = null ) { |
464 | 464 | $t = Title::newFromText( $title ); |
— | — | @@ -469,7 +469,7 @@ |
470 | 470 | $t = Title::newFromText( $title ); |
471 | 471 | if ( is_null( $t ) ) |
472 | 472 | return ''; |
473 | | - return $t->getSubjectPage()->getPrefixedUrl(); |
| 473 | + return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedUrl() ); |
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |