From 8fc36a535ad058641643cbcb5dbdece302e2e53f Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 19 Aug 2011 14:46:03 +0000 Subject: [PATCH] Use canonical URLs (introduced in r94995) for all URLs in e-mails --- includes/User.php | 10 +++++----- includes/UserMailer.php | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/User.php b/includes/User.php index 2dba47e874..a9c3a2f4ac 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 + ); } /** diff --git a/includes/UserMailer.php b/includes/UserMailer.php index eee61fc82d..11040b1e59 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -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 ); -- 2.20.1