* (bug 6957) E-mail confirmation links now using English special page name
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 28 May 2008 18:33:09 +0000 (18:33 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 28 May 2008 18:33:09 +0000 (18:33 +0000)
  for better compatibility and keeping the links shorter. Avoids problem
  with corrupt links in Gmail on IE 6.

RELEASE-NOTES
includes/User.php

index 6cdbb88..f520008 100644 (file)
@@ -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 ===
 
index 4211917..050b3d5 100644 (file)
@@ -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 ) );
        }
 
        /**