ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-Lib-Dev
php-Lib-Dev
[phplib-dev] cvs commit
by uw other posts by this author
May 30 2001 9:28PM messages near this date
[phplib-dev] cvs commit | [phplib-dev] cvs commit
From: uw
Date: Wed May 30 15:16:59 2001
Added files:
      php-lib/php/local4.inc
      php-lib/unsup/phplib-4/README4
      php-lib/unsup/phplib-4/local4.inc
      php-lib/unsup/phplib-4/page4.inc
      php-lib/unsup/phplib-4/prepend.php4
      php-lib/unsup/phplib-4/session4.inc
      php-lib/unsup/phplib-4/user4.inc

Modified files:
      php-lib/php/user4.inc

Log message:
- moved some files to continue the PHP 4 line Kristian sketched
  Someone should continue the work...



Index: php-lib/php/user4.inc
diff -u php-lib/php/user4.inc:1.3 php-lib/php/user4.inc:1.4
--- php-lib/php/user4.inc:1.3	Fri Jan  5 14:58:55 2001
+++ php-lib/php/user4.inc	Wed May 30 15:16:49 2001
@@ -1,143 +1,193 @@
 <?php
-/*
- * Session Management for PHP3
- *
- * Copyright (c) 1998,1999 NetUSE GmbH
- *                    Boris Erdmann, Kristian Koehntopp
- * Copyright (c) 2001, Maxim Derkachev <kot@[...].ru> 
- *
- * $Id: user4.inc,v 1.3 2001/01/05 13:58:55 max Exp $
- *
- */ 
-
+/**
+* Session Management for PHP3
+*
+* @copyright  1998,1999 NetUSE GmbH Boris Erdmann, Kristian Koehntopp
+*             2001, Maxim Derkachev <kot@[...].ru> 
+* @version    $Id: user4.inc,v 1.4 2001/05/30 13:16:49 uw Exp $
+* @package    PHPLib
+* @access     public
+*/ 
 class User {
-  var $classname  = "User";         ## Needed for object serialization.
-  var $that_class = "Session_sql";  ## Name of data storage container
 
-  ##
-  ## End of parameters.
-  ##
+  /**
+  *
+  */
+  var $classname = "User";
+  
+  
+  /**
+  * AC storage name
+  *
+  * @var  string
+  */
+  var $name = "";
+
+  
+  /**
+  * AC storage  ID
+  *
+  * @var  string
+  */
+  var $id = "";
+  
+  
+  /**
+  * A name of a global array where references to registered user vars are stored.
+  *
+  * @var  string
+  */
+  var $vars_array = 'PHPLIB_USER_VARS';
+  
+  
+  /**
+  * Do we need to push user vars into global namespace?
+  * 
+  * (they are anyway accessible via special array, $PHPLIB_USER_VARS by default
+  * 
+  * @var  boolean
+  */
+  var $register_globals = true;		
+  
+  
+  /**
+  * Name of data storage container
+  * 
+  * var string
+  */
+  var $that_class = '';
+  
+  
+  /**
+  *
+  * @var  object CT_*
+  */        
+  var $that;
+  
 
-  var $name;                          ## Session name
-  var $id;                            ## Unique Session ID
+  /**
+  *
+  * @param  string
+  */
+  function start($sid = '') {
+    $this-> get_id($sid);
 
-  var $that;
-  var $vars_array = 'PHPLIB_USER_VARS'; // a name of a global array where references to reg
istered 
-				  	// user vars are stored
-  var $register_globals = true;		// do we need to push user vars into global namespace?
-  					// (they are anyway accessible via special array,
-  					// $PHPLIB_USER_VARS by default
-
-  /* register()
-     registers user variables
-     */
+    if ("" == $this-> name)
+      $this-> name = $this->classname;
+      
+    $name = $this-> that_class;
+    $this-> that = new $name;
+    $this-> that->ac_start();
+
+    $this-> thaw();
+  } // end func start
+  
+  
+  /**
+  * registers user variables
+  *
+  * @param  array
+  */
   function register ($things) {
+  
     $things = explode (",", $things);
+    
     foreach ($things as $thing) {
       $thing = trim($thing);
-      if (!isset($GLOBALS[$thing])) continue;
+      if (!isset($GLOBALS[$thing])) 
+        continue;
+      
       $GLOBALS[$this-> vars_array][$thing] =& $GLOBALS[$thing];
+      
     }
-  }
+    
+  } // end func register
 
 
-  /* is_registered()
-     find out if a var is registered user variable
-     */
+  /**
+  * find out if a var is registered user variable
+  *
+  * @param  string
+ */
   function is_registered($name) {
-    $name = trim($name);
-    if (isset($GLOBALS[$this-> vars_array][$name])) return true;
-    return false;
-  }
+    return (boolean)(isset($GLOBALS[$this-> vars_array][trim($name)]))
+  } // end func is_registered
 
 
-  /* unregister()
-     cancel the registration of a registered user variables
-     */
+  /**
+  * cancel the registration of a registered user variables
+  *
+  */
   function unregister($things) {
+  
     $things = explode (",", $things);
+    
     foreach ($things as $thing) {
       $thing = trim($thing);
-      if (!isset ($GLOBALS[$this-> vars_array][$thing])) continue;
+      if (!isset ($GLOBALS[$this-> vars_array][$thing])) 
+        continue;
+        
       unset ($GLOBALS[$this-> vars_array][$thing]);
     }
-  }
+    
+  } // end func unregister
   
-  ## get_id():
-  ##
-  ## Propagate the session id according to mode and lifetime.
-  ## Will create a new id if necessary. To take over abandoned sessions,
-  ## one may provide the new session id as a parameter (not recommended).
+  /**
+  *
+  * @param string
+  */
   function get_id($id = "") {
     $this-> id = $id;
-  }
+  } // end func get_id
   
-  ## put_id():
-  ## 
-  ## Stop using the current session id (unset cookie, ...) and
-  ## abandon a session.
-  function put_id() {
-    ;
-  }
-
-  ## delete():
-  ##
-  ## Delete the current user record 
-  
+
+  /**
+  * Delete the current user record 
+  */
   function delete() {
       $this-> that->ac_delete($this->id, $this->name);
-  }
+  } // end func delete
 
   
-  /* serialize()
-     serializes user data (stored in $GLOBALS[$this-> vars_array])
-     */
-  function serialize () {
-    $str = serialize($GLOBALS[$this-> vars_array]);
-    return $str;
-  }
+  /**
+  * serializes user data (stored in $GLOBALS[$this-> vars_array])
+  */
+  function serialize() {
+    return serialize($GLOBALS[$this-> vars_array]);
+  } // end func serialize
 
 
-  /* freeze()
-     prepare serialized user data and store it in a storage container
-     */
+  /**
+  * prepare serialized user data and store it in a storage container
+  *
+  */
   function freeze() {
-    $str = '';
-    $str = $this-> serialize();
-    $r = $this-> that->ac_store($this->id, $this->name, $str);
-    if(!$r) $this-> that->ac_halt("User: freeze() failed.");
-  } 
+    if(!$this-> that->ac_store($this->id, $this->name, $this->serialize()))
+      $this-> that->ac_halt("User: freeze() failed.");
+  } // end func freeze
     
   
-  /* thaw()
-     restore saved registered user variables
-     */
+  /* 
+  * restore saved registered user variables
+  **/
   function thaw() {
+  
     $vals = $this-> that->ac_get_value($this->id, $this->name);
-    $GLOBALS[$this-> vars_array] = unserialize ($vals);
+    
+    $GLOBALS[$this-> vars_array] = unserialize($vals);
+    
     if ($this-> register_globals && is_array ($GLOBALS[$this->vars_array]) ) {
+    
       reset ($GLOBALS[$this-> vars_array]);
       while (list ($k, $v) = each ($GLOBALS[$this-> vars_array])) {
-	$GLOBALS[$k] = $v;
-	$GLOBALS[$this-> vars_array][$k] =& $GLOBALS[$k]; // change the entry in user vars array, s
o it is now a reference pointing to a global variable. 
+        $GLOBALS[$k] = $v;
+        $GLOBALS[$this-> vars_array][$k] =& $GLOBALS[$k]; // change the entry in user vars a
rray, so it is now a reference pointing to a global variable. 
       }
+      
     }
-  }
-  
-  ##
-  ## Initialization
-  ##
+    
+  } // end func thaw
 
-  function start($sid = "") {
-    $this-> get_id($sid);
-	
-    if(!isset($this-> cookiename)) { $this->cookiename=""; };
-	$this-> name = $this->cookiename == "" ? $this->classname : $this->cookiename;
-	$name = $this-> that_class;
-	$this-> that = new $name;
-	$this-> that->ac_start();
- 
-    $this-> thaw();
-  }
-}
-?> 
+
+ } // end class User
+?> 
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe@[...].de
For additional commands, e-mail: phplib-dev-help@lists.netuse.de

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved