r106165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106164‎ | r106165 | r106166 >
Date:04:26, 14 December 2011
Author:preilly
Status:ok
Tags:
Comment:
1.18wmf1: MFT r106164
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -422,19 +422,22 @@
423423
424424 public function beforePageRedirect( $out, &$redirect, &$code ) {
425425 if ( $out->getTitle()->isSpecial( 'Userlogin' ) ) {
426 - global $wgMobileDomain;
427 - $parsedUrl = wfParseUrl( $redirect );
428 - if ( stristr( $parsedUrl['host'], $wgMobileDomain ) === false ) {
429 - $hostParts = explode( '.', $parsedUrl['host'] );
430 - $parsedUrl['host'] = $hostParts[0] . $wgMobileDomain . $hostParts[1] . '.' . $hostParts[2];
 426+ global $wgMobileDomain, $wgRequest;
 427+ $requestURL = $wgRequest->getFullRequestURL();
 428+ if ( stristr( $requestURL, $wgMobileDomain ) !== false ) {
 429+ $parsedUrl = wfParseUrl( $redirect );
 430+ if ( stristr( $parsedUrl['host'], $wgMobileDomain ) === false ) {
 431+ $hostParts = explode( '.', $parsedUrl['host'] );
 432+ $parsedUrl['host'] = $hostParts[0] . $wgMobileDomain . $hostParts[1] . '.' . $hostParts[2];
 433+ }
 434+ if ( $parsedUrl['scheme'] == 'http' ) {
 435+ $parsedUrl['scheme'] = 'https';
 436+ }
 437+ $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : '';
 438+ $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : '';
 439+ $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path']
 440+ . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
431441 }
432 - if ( $parsedUrl['scheme'] == 'http' ) {
433 - $parsedUrl['scheme'] = 'https';
434 - }
435 - $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : '';
436 - $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : '';
437 - $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path']
438 - . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
439442 }
440443 return true;
441444 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106164fix redirect issuepreilly04:26, 14 December 2011

Status & tagging log