From f464fa0e84552a7cf4e72624289c366524094f01 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 21 Jun 2006 16:28:04 +0000 Subject: [PATCH] Saner handling of title objects in OutputPage::returnToMain() --- includes/OutputPage.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 69e8521292..14b1b618d4 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -903,21 +903,26 @@ class OutputPage { */ function returnToMain( $auto = true, $returnto = NULL ) { global $wgUser, $wgOut, $wgRequest; - + if ( $returnto == NULL ) { $returnto = $wgRequest->getText( 'returnto' ); } - $returnto = htmlspecialchars( $returnto ); - - $sk = $wgUser->getSkin(); - if ( '' == $returnto ) { + + if ( '' === $returnto ) { $returnto = wfMsgForContent( 'mainpage' ); } - $link = $sk->makeLinkObj( Title::newFromText( $returnto ), '' ); + + if ( is_object( $returnto ) ) { + $titleObj = $returnto; + } else { + $titleObj = Title::newFromText( $returnto ); + } + + $sk = $wgUser->getSkin(); + $link = $sk->makeLinkObj( $titleObj, '' ); $r = wfMsg( 'returnto', $link ); if ( $auto ) { - $titleObj = Title::newFromText( $returnto ); $wgOut->addMeta( 'http:Refresh', '10;url=' . $titleObj->escapeFullURL() ); } $wgOut->addHTML( "\n

$r

\n" ); -- 2.20.1