cvs: pear /Perm_LiveUser LoginManager.php

From: Date: Wed, 21 Aug 2002 23:42:08 +0000
Subject: cvs: pear /Perm_LiveUser LoginManager.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5874@lists.php.net to get a copy of this message
mw21st Wed Aug 21 19:42:08 2002 EDT Modified files: /pear/Perm_LiveUser LoginManager.php Log: Changed the new unfreeze() method: Now uses the backend´s "backendArrayIndex" property to allow reusing of an existing connection even after the user object is retrieved from the session Index: pear/Perm_LiveUser/LoginManager.php diff -u pear/Perm_LiveUser/LoginManager.php:1.1 pear/Perm_LiveUser/LoginManager.php:1.2 --- pear/Perm_LiveUser/LoginManager.php:1.1 Wed Aug 21 18:42:48 2002 +++ pear/Perm_LiveUser/LoginManager.php Wed Aug 21 19:42:08 2002 @@ -46,7 +46,7 @@ * we're working on it ;-)) * * @author Markus Wolff <wolff@21st.de> - * @version $Id: LoginManager.php,v 1.1 2002/08/21 22:42:48 mw21st Exp $ + * @version $Id: LoginManager.php,v 1.2 2002/08/21 23:42:08 mw21st Exp $ **/ class LoginManager { @@ -268,6 +268,8 @@ /** * LoginManager::tryLoginByCookie() * + * THIS METHOD NEEDS FIXING !!!!! + * * @return **/ function tryLoginByCookie() @@ -301,17 +303,26 @@ TRUE); if ($this->user->logged_in) { + // Mark the array index number of the backend that was used + // to retrieve this user´s data + $this->user->backendArrayIndex = $counter; + // Read user's rights from database if (!$this->user->ondemand) { $this->user->readRights(); $this->user->freeze($this); } $userFound = TRUE; + } elseif ($this->user->handle != "") { // The user was found in the database, but couldn't login, so // he's most likely not activated or entered a wrong password. // It is not required to query any other servers. $userFound = TRUE; + + // Mark the array index number of the backend that was used + // to retrieve this user´s data + $this->user->backendArrayIndex = $counter; } $counter++; @@ -321,6 +332,15 @@ function unfreeze() { $this->user = unserialize($_SESSION[$this->sessionVarName]); + + // Use the same backend connection as for the first login + $i = $this->user->backendArrayIndex; + + if (isset($this->backends[$i]['connection'])) { + $this->user = new $classname($this->backends[$i]['connection']); + } else { + $this->user = new $classname($this->backends[$i]); + } $this->user->unfreeze(); }

« previous php.pear.cvs (#5874) next »