Use canonical URLs (introduced in r94995) for all URLs in e-mails
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 14:46:03 +0000 (14:46 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 14:46:03 +0000 (14:46 +0000)
includes/User.php
includes/UserMailer.php

index 2dba47e..a9c3a2f 100644 (file)
@@ -3315,14 +3315,14 @@ class User {
         * @return String Formatted URL
         */
        protected function getTokenUrl( $page, $token ) {
-               global $wgArticlePath;
-               return wfExpandUrl(
+               global $wgCanonicalServer, $wgArticlePath;
+               
+               return $wgCanonicalServer .
                        str_replace(
                                '$1',
                                "Special:$page/$token",
-                               $wgArticlePath ),
-                       PROTO_HTTP
-               );
+                               $wgArticlePath
+                       );
        }
 
        /**
index eee61fc..11040b1 100644 (file)
@@ -523,7 +523,7 @@ class EmailNotification {
                $keys    = array();
 
                if ( $this->oldid ) {
-                       $difflink = wfExpandUrl( $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid ), PROTO_HTTP );
+                       $difflink = $this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid );
                        $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
                        $keys['$OLDID']   = $this->oldid;
                        $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
@@ -540,17 +540,17 @@ class EmailNotification {
                         * revision.
                         */
                        $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
-                                       wfExpandUrl( $this->title->getFullURL( "oldid={$this->oldid}&diff=next" ), PROTO_HTTP ) );
+                                       $this->title->getCanonicalUrl( "oldid={$this->oldid}&diff=next" ) );
                }
 
                $body = strtr( $body, $keys );
                $pagetitle = $this->title->getPrefixedText();
                $keys['$PAGETITLE']          = $pagetitle;
-               $keys['$PAGETITLE_URL']      = wfExpandUrl( $this->title->getFullUrl(), PROTO_HTTP );
+               $keys['$PAGETITLE_URL']      = $this->title->getCanonicalUrl();
 
                $keys['$PAGEMINOREDIT']      = $medit;
                $keys['$PAGESUMMARY']        = $summary;
-               $keys['$UNWATCHURL']         = wfExpandUrl( $this->title->getFullUrl( 'action=unwatch' ), PROTO_HTTP );
+               $keys['$UNWATCHURL']         = $this->title->getCanonicalUrl( 'action=unwatch' );
 
                $subject = strtr( $subject, $keys );
 
@@ -585,10 +585,10 @@ class EmailNotification {
                        $subject = str_replace( '$PAGEEDITOR', $name, $subject );
                        $keys['$PAGEEDITOR']          = $name;
                        $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name );
-                       $keys['$PAGEEDITOR_EMAIL'] = wfExpandUrl( $emailPage->getFullUrl(), PROTO_HTTP );
+                       $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl();
                }
                $userPage = $editor->getUserPage();
-               $keys['$PAGEEDITOR_WIKI'] = wfExpandUrl( $userPage->getFullUrl(), PROTO_HTTP );
+               $keys['$PAGEEDITOR_WIKI'] = $userPage->getCanonicalUrl();
                $body = strtr( $body, $keys );
                $body = wordwrap( $body, 72 );