Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -566,10 +566,26 @@ |
567 | 567 | |
568 | 568 | /* set up the default links for the personal toolbar */ |
569 | 569 | $personal_urls = array(); |
570 | | - $page = $wgRequest->getVal( 'returnto', $this->thisurl ); |
571 | | - $query = $wgRequest->getVal( 'returntoquery', $this->thisquery ); |
572 | | - $returnto = wfArrayToCGI( array( 'returnto' => $page ) ); |
573 | | - if( $this->thisquery != '' ) { |
| 570 | + |
| 571 | + // Get the returnto and returntoquery parameters from the query string |
| 572 | + // or fall back on $this->thisurl or $this->thisquery |
| 573 | + // We can't use getVal()'s default value feature here because |
| 574 | + // stuff from $wgRequest needs to be escaped, but thisurl and thisquery |
| 575 | + // are already escaped. |
| 576 | + $page = $wgRequest->getVal( 'returnto' ); |
| 577 | + if ( !is_null( $page ) ) { |
| 578 | + $page = wfUrlencode( $page ); |
| 579 | + } else { |
| 580 | + $page = $this->thisurl; |
| 581 | + } |
| 582 | + $query = $wgRequest->getVal( 'returntoquery' ); |
| 583 | + if ( !is_null( $query ) ) { |
| 584 | + $query = wfUrlencode( $query ); |
| 585 | + } else { |
| 586 | + $query = $this->thisquery; |
| 587 | + } |
| 588 | + $returnto = "returnto=$page"; |
| 589 | + if( $query != '' ) { |
574 | 590 | $returnto .= "&returntoquery=$query"; |
575 | 591 | } |
576 | 592 | if( $this->loggedin ) { |