From: Tim Starling Date: Thu, 29 May 2008 07:50:27 +0000 (+0000) Subject: * Fix CentralAuth logout, was mostly broken. X-Git-Tag: 1.31.0-rc.0~47310 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=65a6465cd461b17e77817b86a7e137a6754a74d5;p=lhc%2Fweb%2Fwiklou.git * Fix CentralAuth logout, was mostly broken. * Allow the image returned by Special:AutoLogin to be customised. Feature in progress. --- diff --git a/includes/User.php b/includes/User.php index 050b3d5e61..77dce0b7c1 100644 --- a/includes/User.php +++ b/includes/User.php @@ -747,6 +747,8 @@ class User { $this->mRegistration = wfTimestamp( TS_MW ); $this->mGroups = array(); + wfRunHooks( 'UserLoadDefaults', array( $this, $name ) ); + wfProfileOut( __METHOD__ ); } @@ -2122,19 +2124,29 @@ class User { function setCookies() { $this->load(); if ( 0 == $this->mId ) return; - - $_SESSION['wsUserID'] = $this->mId; - - $this->setCookie( 'UserID', $this->mId ); - $this->setCookie( 'UserName', $this->getName() ); - - $_SESSION['wsUserName'] = $this->getName(); - - $_SESSION['wsToken'] = $this->mToken; + $session = array( + 'wsUserID' => $this->mId, + 'wsToken' => $this->mToken, + 'wsUserName' => $this->getName() + ); + $cookies = array( + 'UserID' => $this->mId, + 'UserName' => $this->getName(), + ); if ( 1 == $this->getOption( 'rememberpassword' ) ) { - $this->setCookie( 'Token', $this->mToken ); + $cookies['Token'] = $this->mToken; } else { - $this->clearCookie( 'Token' ); + $cookies['Token'] = false; + } + + wfRunHooks( 'UserSetCookies', array( $this, &$session, &$cookies ) ); + $_SESSION = $session + $_SESSION; + foreach ( $cookies as $name => $value ) { + if ( $value === false ) { + $this->clearCookie( $name ); + } else { + $this->setCookie( $name, $value ); + } } }