r96628 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96627‎ | r96628 | r96629 >
Date:23:32, 8 September 2011
Author:preilly
Status:ok
Tags:
Comment:
fix for footer links
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -104,6 +104,7 @@
105105 public static $viewNormalSiteURL;
106106 public static $currentURL;
107107 public static $displayNoticeId;
 108+ public static $leaveFeedbackURL;
108109
109110 public static $messageKeys = array(
110111 'mobile-frontend-show-button',
@@ -200,6 +201,7 @@
201202 self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=disable_mobile_site' );
202203 self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=view_normal_site' );
203204 self::$currentURL = htmlspecialchars( $wgRequest->getFullRequestURL() );
 205+ self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 'mobileaction=leave_feedback' );
204206
205207 $skin = $wgUser->getSkin();
206208 $copyright = $skin->getCopyright();
@@ -288,6 +290,7 @@
289291 $wgRequest->response()->setcookie( 'disableImages', 1 );
290292 $location = str_replace( '?disableImages=1', '', str_replace( '&disableImages=1', '', $wgRequest->getFullRequestURL() ) );
291293 $location = str_replace( '&mfi=1', '', str_replace( '&mfi=0', '', $location ) );
 294+ $location = $this->getRelativeURL( $location );
292295 $wgRequest->response()->header( 'Location: ' . $location . '&mfi=0' );
293296 }
294297
@@ -305,6 +308,7 @@
306309 }
307310 $location = str_replace( '?enableImages=1', '', str_replace( '&enableImages=1', '', $wgRequest->getFullRequestURL() ) );
308311 $location = str_replace( '&mfi=1', '', str_replace( '&mfi=0', '', $location ) );
 312+ $location = $this->getRelativeURL( $location );
309313 $wgRequest->response()->header( 'Location: ' . $location . '&mfi=1' );
310314 }
311315
@@ -364,6 +368,7 @@
365369 }
366370
367371 $location = str_replace( '&mobileaction=leave_feedback_post', '', $wgRequest->getFullRequestURL() . '&noticeid=1' );
 372+ $location = $this->getRelativeURL( $location );
368373 $wgRequest->response()->header( 'Location: ' . $location );
369374 wfProfileOut( __METHOD__ );
370375 exit();
@@ -468,6 +473,21 @@
469474 }
470475 }
471476
 477+ private function getRelativeURL($url) {
 478+ wfProfileIn( __METHOD__ );
 479+ $parsedUrl = parse_url($url);
 480+ //Validates value as IP address
 481+ if( !IP::isValid( $parsedUrl['host'] ) ) {
 482+ wfProfileOut( __METHOD__ );
 483+ $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
 484+ $baseUrl = str_replace($baseUrl, '', $url);
 485+ return $baseUrl;
 486+ } else {
 487+ wfProfileOut( __METHOD__ );
 488+ return $url;
 489+ }
 490+ }
 491+
472492 private function disableCaching() {
473493 global $wgRequest;
474494 wfProfileIn( __METHOD__ );
Index: trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php
@@ -7,8 +7,7 @@
88 $enableImages = self::$messages['mobile-frontend-enable-images'];
99 $leaveFeedback = self::$messages['mobile-frontend-leave-feedback'];
1010
11 -$leaveFeedbackURL = self::$currentURL . '&mobileaction=leave_feedback';
12 -
 11+$leaveFeedbackURL = self::$leaveFeedbackURL;
1312 $disableMobileSiteURL = self::$disableMobileSiteURL;
1413 $viewNormalSiteURL = self::$viewNormalSiteURL;
1514

Follow-up revisions

RevisionCommit summaryAuthorDate
r96629mft r96628preilly23:33, 8 September 2011

Status & tagging log