[phplib-dev] cvs commit From: uw (phplib-dev <email protected>)
Date: 05/30/01

From: uw
Date: Wed May 30 12:49:50 2001
Modified files:
      php-lib/php/session/session4_custom.inc

Log message:
.. forgot.

Index: php-lib/php/session/session4_custom.inc
diff -u php-lib/php/session/session4_custom.inc:1.11 php-lib/php/session/session4_custom.inc:1.12
--- php-lib/php/session/session4_custom.inc:1.11 Wed May 30 12:48:25 2001
+++ php-lib/php/session/session4_custom.inc Wed May 30 12:49:18 2001
@@ -1,18 +1,17 @@
 <?php
 require_once("./session4.inc");
-/*
- * Session Management for PHP4
- *
- * Copyright (c) 1998,1999 NetUSE GmbH
- * Boris Erdmann, Kristian Koehntopp
- *
- * Copyright (c) 2000 Maxim Derkachev <kot <email protected>>
- * some of the code taken from Teodor Cimpoesu's session4 class
- * Copyright (c) 2000 Teodor Cimpoesu <teo <email protected>>
- *
- * $Id: session4_custom.inc,v 1.11 2001/05/30 10:48:25 uw Exp $
- *
- */
+/**
+* PHPLib Sessions using PHP 4 build-in sessions and PHPLib storage container
+*
+*  <email protected> (c) 1998,1999 NetUSE GmbH Boris Erdmann, Kristian Koehntopp,
+* 2000 Maxim Derkachev <kot <email protected>>,
+* 2000 Teodor Cimpoesu <teo <email protected>>
+*  <email protected> Maxim Derkachev <kot <email protected>>, Teodor Cimpoesu <teo <email protected>>,
+* Ulf Wendel <uw <email protected>>
+*  <email protected> $Id: session4_custom.inc,v 1.12 2001/05/30 10:49:18 uw Exp $
+*  <email protected> PHPLib
+*  <email protected> public
+*/
 
 class Session4_Custom extends Session4 {
 
@@ -58,14 +57,14 @@
   *
   *  <email protected> int
   */
- var $allowcache_expire = 1440;
-
-
+ var $allowcache_expire = 1440;
+
+
   /**
   * session storage module - user, files or mm
   *
   *  <email protected> string
- */
+ */
   var $module = 'user';
   
   
@@ -82,7 +81,7 @@
   *
   * var string
   */
- var $that_class = '';
+ var $that_class = '';
   
   /**
   *
@@ -98,58 +97,64 @@
   var $gc_time = 1440;
 
   
- // compatibility properties
+ /**
+ *
+ *  <email protected> string
+ *  <email protected> $Id: session4_custom.inc,v 1.12 2001/05/30 10:49:18 uw Exp $
+ */
   var $fallback_mode;
- var $gc_probability; ## set this in php.ini or httpd.conf (.htaccess)
- var $secure_auto_init = 1; ## Set to 0 only, if all pages call
- var $in = false; ## Marker: Did we already include the autoinit file?
- var $magic = ''; ## Some string you should change.
   
- function get_lock() {
- $this->that->ac_get_lock();
- }
-
- function release_lock() {
- $this->that->ac_release_lock();
- }
-
   
+ /**
+ * Garbaga collection probability
+ *
+ * Set this in php.ini or httpd.conf (.htaccess)
+ *
+ *  <email protected> int
+ */
+ var $gc_probability;
   
- // initialization
+
+ /**
+ * initialization
+ */
   function start() {
+
     $this->set_container();
     $this->set_tokenname();
     $this->put_headers();
-  <email protected>();
- if ($this->module != 'user')
- $this->get_id(); // otherwise get_id() is called in custom open() method
- }
+
+ $ok = session_start();
+ $this->id();
+
+ return $ok;
+ } // end func
   
   // the following functions used in session_set_save_handler
   
- /*
- open callback
-  <email protected> private
+ /**
+ * Open callback
+ *
+ * abstract
   */
-
   function open() {
- $this->get_id();
     return true;
- }
+ } // end func open
 
- /*
- close callback
-  <email protected> private
+
+ /**
+ * Close callback
+ *
+ *  <email protected>
   */
   function close() {
     return true;
- }
+ } // end func close
   
   
- /*
- delete callback.
-  <email protected> private
- */
+ /**
+ * Delete callback
+ */
   function del () {
     
     if ($this->module == 'user') {
@@ -158,56 +163,66 @@
     }
     
     return true;
- }
+ } // end func del
+
   
   /*
- write callback.
-  <email protected> private
+ * Write callback.
+ *
   */
- function freeze () {
+ function freeze() {
+
     if ($this->module == 'user') {
- $str = session_encode();
- $r = $this->that->ac_store($this->id, $this->name, $str);
- #$this->release_lock();
- return $r;
+
+ $r = $this->that->ac_store($this->id, $this->name, session_encode());
+ $this->release_lock();
+
+ if(!$r)
+ $this->that->ac_halt("Session: freeze() failed.");
     }
- return true;
- }
+
+ } // end func freeze
 
- /*
- read callback.
-  <email protected> private
+
+ /**
+ * Read callback.
   */
   function thaw() {
   
       if ($this->module == 'user') {
         # $this->get_lock();
- return $this->that->ac_get_value($this->id, $this->name);;
+ return $this->that->ac_get_value($this->id, $this->name);
       }
       
       return true;
   }
     
- /*
- gc callback.
- Destroy all session data older than $this->gc_time
-  <email protected> private
+ /**
+ * gc callback.
+ *
+ * Destroy all session data older than $this->gc_time
+ *
   */
   function gc() {
+
     if ($this->module == 'user') {
     
- if (!$this->gc_time )
+ if (empty($this->gc_time))
         $this->gc_time = get_cfg_var("session.gc_maxlifetime");
     
       return $this->that->ac_gc($this->gc_time, $this->name);
     }
     
     return true;
- }
+ } // end func gc
 
 
   // helper functions used in initialization
 
+ /**
+ * ?
+ *
+ */
   function set_container(){
   
     switch ($this->module) {
@@ -242,10 +257,16 @@
         break;
     }
     
- }
+ } // end func set_container
 
+
+ /**
+ * ?
+ *
+ */
   function set_tokenname(){
- $this->name = ($this->cookiename=="") ? $this->classname : $this->cookiename;
+
+ $this->name = ("" == $this->cookiename) ? $this->classname : $this->cookiename;
       session_name ($this->name);
       
       if (!$this->cookie_domain) {
@@ -265,8 +286,13 @@
       }
       
       session_set_cookie_params($lifetime, $this->cookie_path, $this->cookie_domain);
- }
+ } // end func set_tokenname
 
+
+ /**
+ * ?
+ *
+ */
   function put_headers() {
     # set session.cache_limiter corresponding to $this->allowcache.
     
@@ -275,17 +301,34 @@
       case "passive":
       case "public":
         session_cache_limiter ("public");
- break;
+ break;
  
       case "private":
         session_cache_limiter ("private");
- break;
+ break;
 
       default:
         session_cache_limiter ("nocache");
- break;
+ break;
     }
- }
+ } // end func put_headers
+
+
+ /**
+ * ?
+ */
+ function get_lock() {
+ $this->that->ac_get_lock();
+ } // end func get_clock
+
+
+ /**
+ * ?
+ */
+ function release_lock() {
+ $this->that->ac_release_lock();
+ } // end func release_lock
+
   
-}
-?>
+} // end class Session4_Custom
+?>
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>