Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -104,6 +104,7 @@ |
105 | 105 | public static $viewNormalSiteURL; |
106 | 106 | public static $currentURL; |
107 | 107 | public static $displayNoticeId; |
| 108 | + public static $leaveFeedbackURL; |
108 | 109 | |
109 | 110 | public static $messageKeys = array( |
110 | 111 | 'mobile-frontend-show-button', |
— | — | @@ -200,6 +201,7 @@ |
201 | 202 | self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=disable_mobile_site' ); |
202 | 203 | self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=view_normal_site' ); |
203 | 204 | self::$currentURL = htmlspecialchars( $wgRequest->getFullRequestURL() ); |
| 205 | + self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 'mobileaction=leave_feedback' ); |
204 | 206 | |
205 | 207 | $skin = $wgUser->getSkin(); |
206 | 208 | $copyright = $skin->getCopyright(); |
— | — | @@ -288,6 +290,7 @@ |
289 | 291 | $wgRequest->response()->setcookie( 'disableImages', 1 ); |
290 | 292 | $location = str_replace( '?disableImages=1', '', str_replace( '&disableImages=1', '', $wgRequest->getFullRequestURL() ) ); |
291 | 293 | $location = str_replace( '&mfi=1', '', str_replace( '&mfi=0', '', $location ) ); |
| 294 | + $location = $this->getRelativeURL( $location ); |
292 | 295 | $wgRequest->response()->header( 'Location: ' . $location . '&mfi=0' ); |
293 | 296 | } |
294 | 297 | |
— | — | @@ -305,6 +308,7 @@ |
306 | 309 | } |
307 | 310 | $location = str_replace( '?enableImages=1', '', str_replace( '&enableImages=1', '', $wgRequest->getFullRequestURL() ) ); |
308 | 311 | $location = str_replace( '&mfi=1', '', str_replace( '&mfi=0', '', $location ) ); |
| 312 | + $location = $this->getRelativeURL( $location ); |
309 | 313 | $wgRequest->response()->header( 'Location: ' . $location . '&mfi=1' ); |
310 | 314 | } |
311 | 315 | |
— | — | @@ -364,6 +368,7 @@ |
365 | 369 | } |
366 | 370 | |
367 | 371 | $location = str_replace( '&mobileaction=leave_feedback_post', '', $wgRequest->getFullRequestURL() . '¬iceid=1' ); |
| 372 | + $location = $this->getRelativeURL( $location ); |
368 | 373 | $wgRequest->response()->header( 'Location: ' . $location ); |
369 | 374 | wfProfileOut( __METHOD__ ); |
370 | 375 | exit(); |
— | — | @@ -468,6 +473,21 @@ |
469 | 474 | } |
470 | 475 | } |
471 | 476 | |
| 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 | + |
472 | 492 | private function disableCaching() { |
473 | 493 | global $wgRequest; |
474 | 494 | wfProfileIn( __METHOD__ ); |
Index: trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php |
— | — | @@ -7,8 +7,7 @@ |
8 | 8 | $enableImages = self::$messages['mobile-frontend-enable-images']; |
9 | 9 | $leaveFeedback = self::$messages['mobile-frontend-leave-feedback']; |
10 | 10 | |
11 | | -$leaveFeedbackURL = self::$currentURL . '&mobileaction=leave_feedback'; |
12 | | - |
| 11 | +$leaveFeedbackURL = self::$leaveFeedbackURL; |
13 | 12 | $disableMobileSiteURL = self::$disableMobileSiteURL; |
14 | 13 | $viewNormalSiteURL = self::$viewNormalSiteURL; |
15 | 14 | |