http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96628

Revision: 96628
Author:   preilly
Date:     2011-09-08 23:32:15 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
fix for footer links

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/MobileFrontend.php
    trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-08 22:47:57 UTC 
(rev 96627)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-08 23:32:15 UTC 
(rev 96628)
@@ -104,6 +104,7 @@
        public static $viewNormalSiteURL;
        public static $currentURL;
        public static $displayNoticeId;
+       public static $leaveFeedbackURL;
        
        public static $messageKeys = array( 
                'mobile-frontend-show-button',
@@ -200,6 +201,7 @@
                self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 
'mobileaction=disable_mobile_site' );
                self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 
'mobileaction=view_normal_site' );
                self::$currentURL = htmlspecialchars( 
$wgRequest->getFullRequestURL() );
+               self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 
'mobileaction=leave_feedback' );
                
                $skin = $wgUser->getSkin();
                $copyright = $skin->getCopyright();
@@ -288,6 +290,7 @@
                        $wgRequest->response()->setcookie( 'disableImages', 1 );
                        $location = str_replace( '?disableImages=1', '', 
str_replace( '&disableImages=1', '', $wgRequest->getFullRequestURL() ) );
                        $location = str_replace( '&mfi=1', '', str_replace( 
'&mfi=0', '', $location ) );
+                       $location = $this->getRelativeURL( $location );
                        $wgRequest->response()->header( 'Location: ' . 
$location . '&mfi=0' );
                }
                
@@ -305,6 +308,7 @@
                        }
                        $location = str_replace( '?enableImages=1', '', 
str_replace( '&enableImages=1', '', $wgRequest->getFullRequestURL() ) );
                        $location = str_replace( '&mfi=1', '', str_replace( 
'&mfi=0', '', $location ) );
+                       $location = $this->getRelativeURL( $location );
                        $wgRequest->response()->header( 'Location: ' . 
$location . '&mfi=1' );
                }
 
@@ -364,6 +368,7 @@
                        }
                        
                        $location = str_replace( 
'&mobileaction=leave_feedback_post', '', $wgRequest->getFullRequestURL() . 
'&noticeid=1' );
+                       $location = $this->getRelativeURL( $location );
                        $wgRequest->response()->header( 'Location: ' . 
$location );
                        wfProfileOut( __METHOD__ );
                        exit();
@@ -468,6 +473,21 @@
                }
        }
 
+       private function getRelativeURL($url) {
+               wfProfileIn( __METHOD__ );
+               $parsedUrl = parse_url($url);
+               //Validates value as IP address
+               if( !IP::isValid( $parsedUrl['host'] ) ) {
+                       wfProfileOut( __METHOD__ );
+                       $baseUrl = $parsedUrl['scheme'] . '://' . 
$parsedUrl['host'];
+                       $baseUrl = str_replace($baseUrl, '', $url);
+                       return $baseUrl;
+               } else {
+                       wfProfileOut( __METHOD__ );
+                       return $url;
+               }
+       }
+
        private function disableCaching() {
                global $wgRequest;
                wfProfileIn( __METHOD__ );

Modified: 
trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php
===================================================================
--- trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php     
2011-09-08 22:47:57 UTC (rev 96627)
+++ trunk/extensions/MobileFrontend/views/layout/_footmenu_default.html.php     
2011-09-08 23:32:15 UTC (rev 96628)
@@ -7,8 +7,7 @@
 $enableImages = self::$messages['mobile-frontend-enable-images'];
 $leaveFeedback = self::$messages['mobile-frontend-leave-feedback'];
 
-$leaveFeedbackURL = self::$currentURL . '&mobileaction=leave_feedback';
-
+$leaveFeedbackURL = self::$leaveFeedbackURL;
 $disableMobileSiteURL = self::$disableMobileSiteURL;
 $viewNormalSiteURL = self::$viewNormalSiteURL;
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to