(bug 14335) Use proper $wgUser methods instead of using $_SESSION
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 29 May 2008 18:57:06 +0000 (18:57 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 29 May 2008 18:57:06 +0000 (18:57 +0000)
RELEASE-NOTES
includes/User.php
includes/api/ApiLogin.php

index 9355d36..877a195 100644 (file)
@@ -383,6 +383,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 14243) Only accept post requests in action=edit; patch by HardDisk
 * action=block now returns an ISO8601 timestamp, like all other modules do
 * Added md5 parameter to action=edit
+* (bug 14335) Use proper $wgUser methods instead of using $_SESSION
 
 === Languages updated in 1.13 ===
 
index 77dce0b..5a36eea 100644 (file)
@@ -1578,6 +1578,12 @@ class User {
                $this->mNewpassword = '';
                $this->mNewpassTime = null;
        }
+       
+       function getToken() {
+               $this->load();
+               return $this->mToken;
+       }
+       
        /**
         * Set the random token (used for persistent authentication)
         * Called from loadDefaults() among other places.
index 0b21600..525ec2d 100644 (file)
@@ -105,9 +105,9 @@ class ApiLogin extends ApiBase {
                                $wgUser->setCookies();
 
                                $result['result'] = 'Success';
-                               $result['lguserid'] = $_SESSION['wsUserID'];
-                               $result['lgusername'] = $_SESSION['wsUserName'];
-                               $result['lgtoken'] = $_SESSION['wsToken'];
+                               $result['lguserid'] = $wgUser->getId();
+                               $result['lgusername'] = $wgUser->getName();
+                               $result['lgtoken'] = $wgUser->getToken();
                                $result['cookieprefix'] = $wgCookiePrefix;
                                $result['sessionid'] = session_id();
                                break;