cvs: pear /Auth Auth.php /Auth/Container DB.php File.php LDAP.php

From: Date: Wed, 24 Jul 2002 07:25:34 +0000
Subject: cvs: pear /Auth Auth.php /Auth/Container DB.php File.php LDAP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5315@lists.php.net to get a copy of this message
mj Wed Jul 24 03:25:34 2002 EDT Modified files: /pear/Auth Auth.php /pear/Auth/Container DB.php File.php LDAP.php Log: * Patches by James E. Flemer # Full list of changes: http://news.php.net/article.php?group=php.pear.dev&article=7926 Index: pear/Auth/Auth.php diff -u pear/Auth/Auth.php:1.33 pear/Auth/Auth.php:1.34 --- pear/Auth/Auth.php:1.33 Sat May 4 05:42:31 2002 +++ pear/Auth/Auth.php Wed Jul 24 03:25:34 2002 @@ -16,7 +16,7 @@ // | Authors: Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.33 2002/05/04 09:42:31 mj Exp $ +// $Id: Auth.php,v 1.34 2002/07/24 07:25:34 mj Exp $ // require_once "PEAR.php"; @@ -132,7 +132,7 @@ * * @author Martin Jansen <mj@php.net> * @package Auth - * @version $Revision: 1.33 $ + * @version $Revision: 1.34 $ */ define("AUTH_IDLED", -1); @@ -344,6 +344,10 @@ $login_ok = $this->storage->fetchData($this->username, $this->password); } + if (!empty($this->username) && $login_ok) { + $this->setAuth($this->username); + } + /** * If the login failed or the user entered no username, * output the login screen again. @@ -413,6 +417,47 @@ } // }}} + // {{{ setAuthData() + + /** + * Register additional information that is to be stored + * in the session. + * + * @access public + * @param mixed Additional information. This parameter can + * have any type (integer, string, array etc). + * @return mixed Previous value. + */ + function setAuthData($data) + { + if (isset($session['auth']['data'])) { + $olddata = $session['auth']['data']; + } else { + $olddata = null; + } + $session['auth']['data'] = $data; + return $olddata; + } + + // }}} + // {{{ getAuthData() + + /** + * Get additional information that is stored in the session. + * + * @access public + * @return mixed Additional information. + */ + function getAuthData($data) + { + if (isset($session['auth']['data'])) { + return $session['auth']['data']; + } else { + return null; + } + } + + // }}} // {{{ setAuth() /** @@ -421,16 +466,17 @@ * * @access public * @param string Username - * @param mixed Additional information that is stored in - * the session. This parameter can have any - * type (integer, string, array etc). + * @param mixed [Deprecated] Additional information that + * is stored in the session. This parameter + * can have any type (integer, string, array + * etc). * @return void */ function setAuth($username, $data = null) { $session = &Auth::_importGlobalVariable("session"); - if (!isset($session['auth'])) { + if (!isset($session['auth']) && !isset($_SESSION)) { session_register("auth"); } @@ -442,7 +488,7 @@ ); if (!empty($data)) { - $session['auth']['data'] = $data; + $this->setAuthData($data); } } @@ -593,7 +639,11 @@ $session = &$this->_importGlobalVariable("session"); $session['auth'] = ""; - session_unregister("auth"); + if (isset($_SESSION)) { + unset($session['auth']); + } else { + session_unregister("auth"); + } } // }}} Index: pear/Auth/Container/DB.php diff -u pear/Auth/Container/DB.php:1.16 pear/Auth/Container/DB.php:1.17 --- pear/Auth/Container/DB.php:1.16 Mon Jun 24 16:35:06 2002 +++ pear/Auth/Container/DB.php Wed Jul 24 03:25:34 2002 @@ -16,7 +16,7 @@ // | Authors: Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: DB.php,v 1.16 2002/06/24 20:35:06 mj Exp $ +// $Id: DB.php,v 1.17 2002/07/24 07:25:34 mj Exp $ // require_once "Auth/Container.php"; @@ -30,7 +30,7 @@ * * @author Martin Jansen <mj@php.net> * @package Auth - * @version $Revision: 1.16 $ + * @version $Revision: 1.17 $ */ class Auth_Container_DB extends Auth_Container { @@ -219,7 +219,6 @@ $entry[$this->options['passwordcol']], $this->options['cryptType'])) { - Auth::setAuth($entry[$this->options['usernamecol']]); $res->free(); return true; Index: pear/Auth/Container/File.php diff -u pear/Auth/Container/File.php:1.6 pear/Auth/Container/File.php:1.7 --- pear/Auth/Container/File.php:1.6 Wed Apr 17 10:51:13 2002 +++ pear/Auth/Container/File.php Wed Jul 24 03:25:34 2002 @@ -18,7 +18,7 @@ // | Mika Tuupola <tuupola@appelsiini.net> | // +----------------------------------------------------------------------+ // -// $Id: File.php,v 1.6 2002/04/17 14:51:13 tuupola Exp $ +// $Id: File.php,v 1.7 2002/07/24 07:25:34 mj Exp $ // require_once "File/Passwd.php"; @@ -33,7 +33,7 @@ * * @author Stefan Ekman <stekman@sedata.net> * @package Auth - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class Auth_Container_File extends Auth_Container { @@ -78,10 +78,6 @@ { $result = $this->pwfile->verifyPassword($username, $password); - if ($result) { - Auth::SetAuth($username); - } - return $result; } Index: pear/Auth/Container/LDAP.php diff -u pear/Auth/Container/LDAP.php:1.5 pear/Auth/Container/LDAP.php:1.6 --- pear/Auth/Container/LDAP.php:1.5 Thu Jun 13 16:41:54 2002 +++ pear/Auth/Container/LDAP.php Wed Jul 24 03:25:34 2002 @@ -16,7 +16,7 @@ // | Authors: Jan Wagner <wagner@netsols.de> | // +----------------------------------------------------------------------+ // -// $Id: LDAP.php,v 1.5 2002/06/13 20:41:54 mj Exp $ +// $Id: LDAP.php,v 1.6 2002/07/24 07:25:34 mj Exp $ // require_once "Auth/Container.php"; @@ -53,7 +53,7 @@ * * @author Jan Wagner <wagner@netsols.de> * @package Auth - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class Auth_Container_LDAP extends Auth_Container { @@ -187,7 +187,6 @@ // try binding as this user with the supplied password if (@ldap_bind($this->conn_id, $user_dn, $password)) { // auth successfull - Auth::setAuth($username); return true; } } @@ -201,3 +200,4 @@ } ?> +

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