if( $wgRequest->getVal( 'printable' ) === 'yes' ) {
$wgOut->setPrintable();
}
-
- if( $curid = $wgRequest->getInt( 'curid' ) ) {
+ $ret = null;
+ $curid = $wgRequest->getInt( 'curid' );
+ if( $curid ) {
// URLs like this are generated by RC, because rc_title isn't always accurate
$ret = Title::newFromID( $curid );
} elseif( $title == '' && $action != 'delete' ) {
*/
function handleSpecialCases( &$title, &$output, $request ) {
wfProfileIn( __METHOD__ );
- global $wgContLang, $wgUser;
+
$action = $this->getVal( 'Action' );
// Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
// Interwiki redirects
} else if( $title->getInterwiki() != '' ) {
- if( $rdfrom = $request->getVal( 'rdfrom' ) ) {
+ $rdfrom = $request->getVal( 'rdfrom' );
+ if( $rdfrom ) {
$url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
} else {
$query = $request->getValues();
}
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
} else if ( $action == 'view' && !$request->wasPosted()
- && ( !$request->getVal( 'title' ) || $title->getPrefixedDBKey() != $request->getText( 'title' ) )
+ && ( $request->getVal( 'title' ) === null || $title->getPrefixedDBKey() != $request->getText( 'title' ) )
&& !count( array_diff( array_keys( $request->getValues() ), array( 'action', 'title' ) ) ) )
{
+ if ( $title->getNamespace() == NS_SPECIAL ) {
+ list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $title->getDBkey() );
+ if ( $name ) {
+ $title = SpecialPage::getTitleFor( $name, $subpage );
+ }
+ }
$targetUrl = $title->getFullURL();
// Redirect to canonical url, make it a 301 to allow caching
if( $targetUrl == $request->getFullRequestURL() ) {