Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1467,11 +1467,13 @@ |
1468 | 1468 | * Add a "return to" link pointing to a specified title |
1469 | 1469 | * |
1470 | 1470 | * @param Title $title Title to link |
| 1471 | + * @param string $query Query string |
1471 | 1472 | */ |
1472 | | - public function addReturnTo( $title ) { |
| 1473 | + public function addReturnTo( $title, $query ) { |
1473 | 1474 | global $wgUser; |
1474 | 1475 | $this->addLink( array( 'rel' => 'next', 'href' => $title->getFullUrl() ) ); |
1475 | | - $link = wfMsgHtml( 'returnto', $wgUser->getSkin()->link( $title ) ); |
| 1476 | + $link = wfMsgHtml( 'returnto', $wgUser->getSkin()->link( |
| 1477 | + $title, null, array(), $query ) ); |
1476 | 1478 | $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" ); |
1477 | 1479 | } |
1478 | 1480 | |
— | — | @@ -1482,12 +1484,16 @@ |
1483 | 1485 | * @param null $unused No longer used |
1484 | 1486 | * @param Title $returnto Title to return to |
1485 | 1487 | */ |
1486 | | - public function returnToMain( $unused = null, $returnto = NULL ) { |
| 1488 | + public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) { |
1487 | 1489 | global $wgRequest; |
1488 | 1490 | |
1489 | | - if ( $returnto == NULL ) { |
| 1491 | + if ( $returnto == null ) { |
1490 | 1492 | $returnto = $wgRequest->getText( 'returnto' ); |
1491 | 1493 | } |
| 1494 | + |
| 1495 | + if ( $returntoquery == null ) { |
| 1496 | + $returntoquery = $wgRequest->getText( 'returntoquery' ); |
| 1497 | + } |
1492 | 1498 | |
1493 | 1499 | if ( '' === $returnto ) { |
1494 | 1500 | $returnto = Title::newMainPage(); |
— | — | @@ -1502,7 +1508,7 @@ |
1503 | 1509 | $titleObj = Title::newMainPage(); |
1504 | 1510 | } |
1505 | 1511 | |
1506 | | - $this->addReturnTo( $titleObj ); |
| 1512 | + $this->addReturnTo( $titleObj, $returntoquery ); |
1507 | 1513 | } |
1508 | 1514 | |
1509 | 1515 | /** |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -862,11 +862,6 @@ |
863 | 863 | */ |
864 | 864 | public function getLinkUrl( $query = array(), $variant = false ) { |
865 | 865 | wfProfileIn( __METHOD__ ); |
866 | | - if( !is_array( $query ) ) { |
867 | | - wfProfileOut( __METHOD__ ); |
868 | | - throw new MWException( 'Title::getLinkUrl passed a non-array for '. |
869 | | - '$query' ); |
870 | | - } |
871 | 866 | if( $this->isExternal() ) { |
872 | 867 | $ret = $this->getFullURL( $query ); |
873 | 868 | } elseif( $this->getPrefixedText() === '' && $this->getFragment() !== '' ) { |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -164,6 +164,9 @@ |
165 | 165 | wfProfileIn( __METHOD__ . '-stuff' ); |
166 | 166 | $this->thispage = $this->mTitle->getPrefixedDBkey(); |
167 | 167 | $this->thisurl = $this->mTitle->getPrefixedURL(); |
| 168 | + $query = $wgRequest->data; |
| 169 | + unset( $query['title'] ); |
| 170 | + $this->thisquery = wfArrayToCGI( $query ); |
168 | 171 | $this->loggedin = $wgUser->isLoggedIn(); |
169 | 172 | $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL ); |
170 | 173 | $this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) ); |
— | — | @@ -562,7 +565,7 @@ |
563 | 566 | $personal_urls['logout'] = array( |
564 | 567 | 'text' => wfMsg( 'userlogout' ), |
565 | 568 | 'href' => self::makeSpecialUrl( 'Userlogout', |
566 | | - $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}" |
| 569 | + $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}&returntoquery={$this->thisquery}" |
567 | 570 | ), |
568 | 571 | 'active' => false |
569 | 572 | ); |
— | — | @@ -589,13 +592,13 @@ |
590 | 593 | ); |
591 | 594 | $personal_urls['anonlogin'] = array( |
592 | 595 | 'text' => wfMsg( $loginlink ), |
593 | | - 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ), |
| 596 | + 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ), |
594 | 597 | 'active' => $title->isSpecial( 'Userlogin' ) |
595 | 598 | ); |
596 | 599 | } else { |
597 | 600 | $personal_urls['login'] = array( |
598 | 601 | 'text' => wfMsg( $loginlink ), |
599 | | - 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ), |
| 602 | + 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ), |
600 | 603 | 'active' => $title->isSpecial( 'Userlogin' ) |
601 | 604 | ); |
602 | 605 | } |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -37,7 +37,8 @@ |
38 | 38 | |
39 | 39 | var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted; |
40 | 40 | var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword; |
41 | | - var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage, $mSkipCookieCheck; |
| 41 | + var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage; |
| 42 | + var $mSkipCookieCheck, $mReturnToQuery; |
42 | 43 | |
43 | 44 | /** |
44 | 45 | * Constructor |
— | — | @@ -53,6 +54,7 @@ |
54 | 55 | $this->mRetype = $request->getText( 'wpRetype' ); |
55 | 56 | $this->mDomain = $request->getText( 'wpDomain' ); |
56 | 57 | $this->mReturnTo = $request->getVal( 'returnto' ); |
| 58 | + $this->mReturnToQuery = $request->getVal( 'returntoquery' ); |
57 | 59 | $this->mCookieCheck = $request->getVal( 'wpCookieCheck' ); |
58 | 60 | $this->mPosted = $request->wasPosted(); |
59 | 61 | $this->mCreateaccount = $request->getCheck( 'wpCreateaccount' ); |
— | — | @@ -68,6 +70,7 @@ |
69 | 71 | |
70 | 72 | if ( $wgRedirectOnLogin ) { |
71 | 73 | $this->mReturnTo = $wgRedirectOnLogin; |
| 74 | + $this->mReturnToQuery = ''; |
72 | 75 | } |
73 | 76 | |
74 | 77 | if( $wgEnableEmail ) { |
— | — | @@ -89,6 +92,7 @@ |
90 | 93 | # When switching accounts, it sucks to get automatically logged out |
91 | 94 | if( $this->mReturnTo == $wgLang->specialPage( 'Userlogout' ) ) { |
92 | 95 | $this->mReturnTo = ''; |
| 96 | + $this->mReturnToQuery = ''; |
93 | 97 | } |
94 | 98 | } |
95 | 99 | |
— | — | @@ -719,8 +723,7 @@ |
720 | 724 | if ( !$titleObj instanceof Title ) { |
721 | 725 | $titleObj = Title::newMainPage(); |
722 | 726 | } |
723 | | - |
724 | | - $wgOut->redirect( $titleObj->getFullURL() ); |
| 727 | + $wgOut->redirect( $titleObj->getFullURL( $this->mReturnToQuery ) ); |
725 | 728 | } |
726 | 729 | } |
727 | 730 | |
— | — | @@ -753,7 +756,7 @@ |
754 | 757 | $wgOut->addHTML( $injected_html ); |
755 | 758 | |
756 | 759 | if ( !empty( $this->mReturnTo ) ) { |
757 | | - $wgOut->returnToMain( null, $this->mReturnTo ); |
| 760 | + $wgOut->returnToMain( null, $this->mReturnTo, $this->mReturnToQuery ); |
758 | 761 | } else { |
759 | 762 | $wgOut->returnToMain( null ); |
760 | 763 | } |
— | — | @@ -852,6 +855,9 @@ |
853 | 856 | |
854 | 857 | if ( !empty( $this->mReturnTo ) ) { |
855 | 858 | $returnto = '&returnto=' . wfUrlencode( $this->mReturnTo ); |
| 859 | + if ( !empty( $this->mReturnToQuery ) ) |
| 860 | + $returnto .= '&returntoquery=' . |
| 861 | + wfUrlencode( $this->mReturnToQuery ); |
856 | 862 | $q .= $returnto; |
857 | 863 | $linkq .= $returnto; |
858 | 864 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -251,6 +251,8 @@ |
252 | 252 | * (bug 19693) User name is now escaped in "Contributions for ..." link on |
253 | 253 | Special:BlockIP |
254 | 254 | * (bug 19571) Override buildConcat for SQLite. |
| 255 | +* Log in and log out links no longer return to page view when clicked from |
| 256 | + history view, edit page, or something similar |
255 | 257 | |
256 | 258 | == API changes in 1.16 == |
257 | 259 | |