cvs: pear /LiveUser LiveUser.php

From: Date: Thu, 19 May 2005 04:39:50 +0000
Subject: cvs: pear /LiveUser LiveUser.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-31914@lists.php.net to get a copy of this message
lsmith Thu May 19 00:39:50 2005 EDT Modified files: /pear/LiveUser LiveUser.php Log: - if no conf was passed LiveUser::singleton will return the current (for practical purposes random) instance in the instances array http://cvs.php.net/diff.php/pear/LiveUser/LiveUser.php?r1=1.68&r2=1.69&ty=u Index: pear/LiveUser/LiveUser.php diff -u pear/LiveUser/LiveUser.php:1.68 pear/LiveUser/LiveUser.php:1.69 --- pear/LiveUser/LiveUser.php:1.68 Thu May 5 14:08:12 2005 +++ pear/LiveUser/LiveUser.php Thu May 19 00:39:49 2005 @@ -40,7 +40,7 @@ * @author Bjoern Kraus <krausbn@php.net> * @copyright 2002-2005 Markus Wolff * @license http://www.gnu.org/licenses/lgpl.txt - * @version CVS: $Id: LiveUser.php,v 1.68 2005/05/05 18:08:12 lsmith Exp $ + * @version CVS: $Id: LiveUser.php,v 1.69 2005/05/19 04:39:49 lsmith Exp $ * @link http://pear.php.net/LiveUser */ @@ -500,7 +500,7 @@ * @see LiveUser::factory * @see LiveUser::getErrors */ - function &singleton($conf, $handle = '', $passwd = '', $logout = false, + function &singleton($conf = array(), $handle = '', $passwd = '', $logout = false, $remember = false, $confName = 'liveuserConfig') { static $instances; @@ -508,12 +508,19 @@ $instances = array(); } - $signature = serialize(array($handle, $passwd, $confName)); - if (!isset($instances[$signature])) { - $obj = &LiveUser::factory( - $conf, $handle, $passwd, $logout, $remember, $confName - ); - $instances[$signature] =& $obj; + if (!empty($conf)) { + if (empty($instances)) { + return false; + } + $signature = key($instances); + } else { + $signature = serialize(array($handle, $passwd, $confName)); + if (!isset($instances[$signature])) { + $obj = &LiveUser::factory( + $conf, $handle, $passwd, $logout, $remember, $confName + ); + $instances[$signature] =& $obj; + } } return $instances[$signature];

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