$t = $this->mTitle->getPrefixedText();
- $noredir = $noredir || ($wgRequest->getVal( 'redirect' ) == 'no');
+ $noredir = $noredir || ($wgRequest->getVal( 'redirect' ) == 'no')
+ || $wgRequest->getCheck( 'rdfrom' );
$this->mOldId = $oldid;
$this->fetchContent( $oldid, $noredir, true );
}
if( $globalTitle ) {
global $wgOut;
if ( $rt->getInterwiki() != '' && $rt->isLocal() ) {
- $wgOut->redirect( $rt->getFullURL() ) ;
+ $source = $this->mTitle->getFullURL( 'redirect=no' );
+ $wgOut->redirect( $rt->getFullURL( 'rdfrom=' . urlencode( $source ) ) ) ;
return false;
}
if ( $rt->getNamespace() == NS_SPECIAL ) {
# Can't cache redirects
$pcache = false;
} elseif ( !empty( $rdfrom ) ) {
- $sk = $wgUser->getSkin();
- $redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
- $s = wfMsg( 'redirectedfrom', $redir );
- $wgOut->setSubtitle( $s );
+ global $wgRedirectSources;
+ if( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
+ $sk = $wgUser->getSkin();
+ $redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
+ $s = wfMsg( 'redirectedfrom', $redir );
+ $wgOut->setSubtitle( $s );
+ }
}
# wrap user css and user js in pre and don't parse
$wgLocalInterwiki = 'w';
$wgInterwikiExpiry = 10800; # Expiry time for cache of interwiki table
+/**
+ * If local interwikis are set up which allow redirects,
+ * set this regexp to restrict URLs which will be displayed
+ * as 'redirected from' links.
+ *
+ * It might look something like this:
+ * $wgRedirectSources = '!^https?://[a-z-]+\.wikipedia\.org/!';
+ *
+ * Leave at false to avoid displaying any incoming redirect markers.
+ * This does not affect intra-wiki redirects, which don't change
+ * the URL.
+ */
+$wgRedirectSources = false;
+
+
$wgShowIPinHeader = true; # For non-logged in users
$wgMaxNameChars = 32; # Maximum number of bytes in username
$namepace .= ':';
}
$url = str_replace( '$1', $namespace . $this->mUrlform, $baseUrl );
+ if( $query != '' ) {
+ if( false === strpos( $url, '?' ) ) {
+ $url .= '?';
+ } else {
+ $url .= '&';
+ }
+ $url .= $query;
+ }
if ( '' != $this->mFragment ) {
$url .= '#' . $this->mFragment;
}
$interwiki = Title::newFromUrl( $_REQUEST['title'] );
if( !is_null( $interwiki ) ) $wgTitle = $interwiki;
}
- $url = $wgTitle->getFullURL();
+ if( $rdfrom = $wgRequest->getVal( 'rdfrom' ) ) {
+ $url = $wgTitle->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
+ } else {
+ $url = $wgTitle->getFullURL();
+ }
# Check for a redirect loop
if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $wgTitle->isLocal() ) {
$wgOut->redirect( $url );