cvs: pear /Auth Auth.php
| From: | Martin Jansen | Date: | Sat, 22 Dec 2001 14:55:25 +0000 |
| Subject: | cvs: pear /Auth Auth.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1659@lists.php.net to get a copy of this message | ||
mj Sat Dec 22 09:55:25 2001 EDT
Modified files:
/pear/Auth Auth.php
Log:
* Auth seems to work even with register_globals=Off
* Simplify code in setAuth()
Index: pear/Auth/Auth.php
diff -u pear/Auth/Auth.php:1.21 pear/Auth/Auth.php:1.22
--- pear/Auth/Auth.php:1.21 Sat Dec 22 09:37:51 2001
+++ pear/Auth/Auth.php Sat Dec 22 09:55:25 2001
@@ -16,7 +16,7 @@
// | Authors: Martin Jansen <mj@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Auth.php,v 1.21 2001/12/22 14:37:51 mj Exp $
+// $Id: Auth.php,v 1.22 2001/12/22 14:55:25 mj Exp $
//
/**
@@ -128,13 +128,9 @@
* $myauth->start();
* }
*
- *
- * Note: PEAR::Auth currently requires register_globals=on in
- * your PHP configuration.
- *
* @author Martin Jansen <mj@php.net>
* @package Auth
- * @version $Revision: 1.21 $
+ * @version $Revision: 1.22 $
*/
define("AUTH_IDLED", -1);
@@ -416,42 +412,24 @@
* @param string Username
* @param array Additional information that is stored in
* the session.
- * @global $HTTP_SESSION_VARS
*/
function setAuth($username, $data = array())
- {
-
- if (isset($_SESSION)) {
-
- if (!isset($_SESSION['auth'])) {
- session_register("auth");
- }
+ {
+ $session = &Auth::_importGlobalVariable("session");
- $_SESSION['auth'] = array(
- 'registered' => true,
- 'username' => $username,
- 'timestamp' => time(),
- 'idle' => time()
- );
-
- if (!empty($data))
- $_SESSION['auth']['data'] = $data;
-
- } else {
-
- if (!isset($GLOBALS['HTTP_SESSION_VARS']['auth'])) {
- session_register("auth");
- }
+ if (!isset($session['auth'])) {
+ session_register("auth");
+ }
- $GLOBALS['auth'] =
&$GLOBALS['HTTP_SESSION_VARS']['auth'];
- $GLOBALS['auth']['registered'] = true;
- $GLOBALS['auth']['username'] = $username;
- $GLOBALS['auth']['timestamp'] = time();
- $GLOBALS['auth']['idle'] = time();
+ $session['auth'] = array(
+ 'registered' => true,
+ 'username' => $username,
+ 'timestamp' => time(),
+ 'idle' => time()
+ );
- if (!empty($data)) {
- $GLOBALS['auth']['data'] = $data;
- }
+ if (!empty($data)) {
+ $session['auth']['data'] = $data;
}
}