cvs: pear /Auth Auth.php

From: Date: Fri, 15 Feb 2002 21:30:19 +0000
Subject: cvs: pear /Auth Auth.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2446@lists.php.net to get a copy of this message
mj Fri Feb 15 16:30:19 2002 EDT Modified files: /pear/Auth Auth.php Log: * Group methods a bit more logical. Index: pear/Auth/Auth.php diff -u pear/Auth/Auth.php:1.29 pear/Auth/Auth.php:1.30 --- pear/Auth/Auth.php:1.29 Thu Feb 7 06:07:12 2002 +++ pear/Auth/Auth.php Fri Feb 15 16:30:19 2002 @@ -16,7 +16,7 @@ // | Authors: Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.29 2002/02/07 11:07:12 mj Exp $ +// $Id: Auth.php,v 1.30 2002/02/15 21:30:19 mj Exp $ // require_once "PEAR.php"; @@ -132,7 +132,7 @@ * * @author Martin Jansen <mj@php.net> * @package Auth - * @version $Revision: 1.29 $ + * @version $Revision: 1.30 $ */ define("AUTH_IDLED", -1); @@ -342,7 +342,7 @@ /** * Set the maximum expire time - * + * * @access public * @param integer time in seconds * @param bool add time to current expire time or not @@ -377,6 +377,55 @@ } // }}} + // {{{ setShowLogin() + + /** + * Should the login form be displayed if neccessary? + * + * @access public + * @param bool show login form or not + * @return void + */ + function setShowLogin($showLogin = true) + { + $this->showLogin = $showLogin; + } + + // }}} + // {{{ setAuth() + + /** + * Register variable in a session telling that the user + * has logged in successfully + * + * @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). + * @return void + */ + function setAuth($username, $data = null) + { + $session = &Auth::_importGlobalVariable("session"); + + if (!isset($session['auth'])) { + session_register("auth"); + } + + $session['auth'] = array( + 'registered' => true, + 'username' => $username, + 'timestamp' => time(), + 'idle' => time() + ); + + if (!empty($data)) { + $session['auth']['data'] = $data; + } + } + + // }}} // {{{ checkAuth() /** @@ -428,40 +477,6 @@ } // }}} - // {{{ setAuth() - - /** - * Register variable in a session telling that the user - * has logged in successfully - * - * @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). - * @return void - */ - function setAuth($username, $data = null) - { - $session = &Auth::_importGlobalVariable("session"); - - if (!isset($session['auth'])) { - session_register("auth"); - } - - $session['auth'] = array( - 'registered' => true, - 'username' => $username, - 'timestamp' => time(), - 'idle' => time() - ); - - if (!empty($data)) { - $session['auth']['data'] = $data; - } - } - - // }}} // {{{ getAuth() /** @@ -475,21 +490,6 @@ $session = &$this->_importGlobalVariable("session"); return (true == !empty($session) && $session['auth']['registered']) ? true : false; - } - - // }}} - // {{{ setShowLogin() - - /** - * Should the login form be displayed if neccessary? - * - * @access public - * @param bool show login form or not - * @return void - */ - function setShowLogin($showLogin = true) - { - $this->showLogin = $showLogin; } // }}}

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