Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -192,6 +192,7 @@ |
193 | 193 | 'Mypage' => 'SpecialMypage', |
194 | 194 | 'Mytalk' => 'SpecialMytalk', |
195 | 195 | 'Myuploads' => 'SpecialMyuploads', |
| 196 | + 'PermanentLink' => 'SpecialPermanentLink', |
196 | 197 | 'Revisiondelete' => 'SpecialRevisionDelete', |
197 | 198 | 'RevisionMove' => 'SpecialRevisionMove', |
198 | 199 | 'Specialpages' => 'SpecialSpecialpages', |
— | — | @@ -541,12 +542,18 @@ |
542 | 543 | # Check for redirect |
543 | 544 | if ( !$including ) { |
544 | 545 | $redirect = $page->getRedirect( $par ); |
545 | | - if ( $redirect ) { |
546 | | - $query = $page->getRedirectQuery(); |
| 546 | + $query = $page->getRedirectQuery(); |
| 547 | + if ( $redirect instanceof Title ) { |
547 | 548 | $url = $redirect->getFullUrl( $query ); |
548 | 549 | $wgOut->redirect( $url ); |
549 | 550 | wfProfileOut( __METHOD__ ); |
550 | 551 | return $redirect; |
| 552 | + } elseif( $redirect === true ) { |
| 553 | + global $wgScript; |
| 554 | + $url = $wgScript . '?' . wfArrayToCGI( $query ); |
| 555 | + $wgOut->redirect( $url ); |
| 556 | + wfProfileOut( __METHOD__ ); |
| 557 | + return $redirect; |
551 | 558 | } |
552 | 559 | } |
553 | 560 | |
— | — | @@ -929,16 +936,20 @@ |
930 | 937 | function getRedirectQuery() { |
931 | 938 | global $wgRequest; |
932 | 939 | $params = array(); |
| 940 | + |
933 | 941 | foreach( $this->mAllowedRedirectParams as $arg ) { |
934 | | - if( ( $val = $wgRequest->getVal( $arg, null ) ) !== null ) |
935 | | - $params[] = $arg . '=' . $val; |
| 942 | + if( $wgRequest->getVal( $arg, null ) !== null ){ |
| 943 | + $params[$arg] = $wgRequest->getVal( $arg ); |
| 944 | + } |
936 | 945 | } |
937 | | - |
| 946 | + |
938 | 947 | foreach( $this->mAddedRedirectParams as $arg => $val ) { |
939 | | - $params[] = $arg . '=' . $val; |
| 948 | + $params[$arg] = $val; |
940 | 949 | } |
941 | | - |
942 | | - return count( $params ) ? implode( '&', $params ) : false; |
| 950 | + |
| 951 | + return count( $params ) |
| 952 | + ? $params |
| 953 | + : false; |
943 | 954 | } |
944 | 955 | } |
945 | 956 | |
— | — | @@ -988,7 +999,8 @@ |
989 | 1000 | } |
990 | 1001 | } |
991 | 1002 | |
992 | | -/** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages |
| 1003 | +/** |
| 1004 | + * SpecialMypage, SpecialMytalk and SpecialMycontributions special pages |
993 | 1005 | * are used to get user independant links pointing to the user page, talk |
994 | 1006 | * page and list of contributions. |
995 | 1007 | * This can let us cache a single copy of any generated content for all |
— | — | @@ -1062,9 +1074,25 @@ |
1063 | 1075 | parent::__construct( 'Myuploads' ); |
1064 | 1076 | $this->mAllowedRedirectParams = array( 'limit' ); |
1065 | 1077 | } |
1066 | | - |
| 1078 | + |
1067 | 1079 | function getRedirect( $subpage ) { |
1068 | 1080 | global $wgUser; |
1069 | 1081 | return SpecialPage::getTitleFor( 'Listfiles', $wgUser->getName() ); |
1070 | 1082 | } |
1071 | 1083 | } |
| 1084 | + |
| 1085 | +/** |
| 1086 | + * Redirect to Special:Listfiles?user=$wgUser |
| 1087 | + */ |
| 1088 | +class SpecialPermanentLink extends UnlistedSpecialPage { |
| 1089 | + function __construct() { |
| 1090 | + parent::__construct( 'PermanentLink' ); |
| 1091 | + $this->mAllowedRedirectParams = array(); |
| 1092 | + } |
| 1093 | + |
| 1094 | + function getRedirect( $subpage ) { |
| 1095 | + $subpage = intval( $subpage ); |
| 1096 | + $this->mAddedRedirectParams['oldid'] = $subpage; |
| 1097 | + return true; |
| 1098 | + } |
| 1099 | +} |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -445,6 +445,7 @@ |
446 | 446 | 'Mytalk' => array( 'MyTalk' ), |
447 | 447 | 'Mycontributions' => array( 'MyContributions' ), |
448 | 448 | 'Myuploads' => array( 'MyUploads' ), |
| 449 | + 'PermanentLink' => array( 'PermanentLink' ), |
449 | 450 | 'Listadmins' => array( 'ListAdmins' ), |
450 | 451 | 'Listbots' => array( 'ListBots' ), |
451 | 452 | 'Popularpages' => array( 'PopularPages' ), |