From b2bbbf3121d948a2422dfcb98eb38882f492b93f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 28 May 2008 18:33:09 +0000 Subject: [PATCH] * (bug 6957) E-mail confirmation links now using English special page name for better compatibility and keeping the links shorter. Avoids problem with corrupt links in Gmail on IE 6. --- RELEASE-NOTES | 4 ++++ includes/User.php | 27 ++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6cdbb88810..f520008d8e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -303,6 +303,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14241) Pages can no longer be protected to levels you are not in * (bug 14296) Fix local name of ang: (Anglo-Saxon) * (bug 4871) Hardcoded superscript in time zone preferences moved to message +* (bug 6957) E-mail confirmation links now using English special page name + for better compatibility and keeping the links shorter. Avoids problem + with corrupt links in Gmail on IE 6. + === API changes in 1.13 === diff --git a/includes/User.php b/includes/User.php index 4211917d5c..050b3d5e61 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2620,8 +2620,7 @@ class User { * @private */ function confirmationTokenUrl( $token ) { - $title = SpecialPage::getTitleFor( 'Confirmemail', $token ); - return $title->getFullUrl(); + return $this->getTokenUrl( 'ConfirmEmail', $token ); } /** * Return a URL the user can use to invalidate their email address. @@ -2629,9 +2628,27 @@ class User { * @return string * @private */ - function invalidationTokenUrl( $token ) { - $title = SpecialPage::getTitleFor( 'Invalidateemail', $token ); - return $title->getFullUrl(); + function invalidationTokenUrl( $token ) { + return $this->getTokenUrl( 'Invalidateemail', $token ); + } + + /** + * Internal function to format the e-mail validation/invalidation URLs. + * This uses $wgArticlePath directly as a quickie hack to use the + * hardcoded English names of the Special: pages, for ASCII safety. + * + * Since these URLs get dropped directly into emails, using the + * short English names avoids insanely long URL-encoded links, which + * also sometimes can get corrupted in some browsers/mailers + * (bug 6957 with Gmail and Internet Explorer). + */ + protected function getTokenUrl( $page, $token ) { + global $wgArticlePath; + return wfExpandUrl( + str_replace( + '$1', + "Special:$page/$token", + $wgArticlePath ) ); } /** -- 2.20.1