From: max
Date: Thu Jan 11 14:47:07 2001
Modified files:
php-lib/php/session/session4_custom.inc
Log message:
Moving to PHP4.0.4 session_set_save_handler(), that may take arrays
(obj, 'method_name') as arguments instead of simple strings. That made
possible to remove all wrappers of sess->methods.
Don't use this version if you use PHP version < 4.0.4.
Use version 1.3 of the class for PHP versions prior to 4.0.4 instead.
Index: php-lib/php/session/session4_custom.inc
diff -u php-lib/php/session/session4_custom.inc:1.3
php-lib/php/session/session4_custom.inc:1.4
--- php-lib/php/session/session4_custom.inc:1.3 Thu Jan 11 09:08:42 2001
+++ php-lib/php/session/session4_custom.inc Thu Jan 11 14:46:35 2001
@@ -6,11 +6,10 @@
* Boris Erdmann, Kristian Koehntopp
*
* Copyright (c) 2000 Maxim Derkachev <[EMAIL PROTECTED]>
- *
* some of the code taken from Teodor Cimpoesu's session4 class
* Copyright (c) 2000 Teodor Cimpoesu <[EMAIL PROTECTED]>
*
- * $Id: session4_custom.inc,v 1.3 2001/01/11 08:08:42 max Exp $
+ * $Id: session4_custom.inc,v 1.4 2001/01/11 13:46:35 max Exp $
*
*/
@@ -73,7 +72,6 @@
$newid = false;
$id = session_id();
-
if (!$id) {
$newid = true;
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
@@ -90,7 +88,6 @@
setcookie ($rhis->name, $this->id, time()+$this->lifetime*60, "/",
$this->cookie_domain);
}
}
-
}
/**
@@ -124,7 +121,7 @@
if (!$HTTP_COOKIE_VARS[$this->name]) {
$url .= ( strpos($url, "?") != false ? "&" : "?" )
- . urlencode($this->name)."="."$this->id";
+ . urlencode($this->name)."=".$this->id;
}
return $url;
@@ -197,7 +194,6 @@
return session_decode ($data_string);
}
- /* OB: no clue on these functions utility */
function reimport_get_vars() {
$this->reimport_any_vars("HTTP_GET_VARS");
}
@@ -294,17 +290,17 @@
$this->that->ac_start();
// set custom session handlers
- session_set_save_handler('mysess_open',
- 'mysess_close',
- 'mysess_read',
- 'mysess_write',
- 'mysess_destroy',
- 'mysess_gc'
+ session_set_save_handler(array (&$this, 'open'),
+ array (&$this, 'close'),
+ array (&$this, 'thaw'),
+ array (&$this, 'freeze'),
+ array (&$this, 'delete'),
+ array (&$this, 'gc')
);
}
function set_tokenname(){
- $this->name = $this->cookiename==""?$this->classname:$this->cookiename;
+ $this->name = ($this->cookiename=="") ? $this->classname : $this->cookiename;
session_name ($this->name);
}
@@ -327,43 +323,5 @@
break;
}
}
-
-
-
-}
-
-/* wrappers for session_set_save_handler().
- Could not manage to make session_set_save_handler()
- take $sess->methods as arguments.
- */
-
-function mysess_open() {
- global $sess;
- return $sess->open();
-}
-
-function mysess_close() {
- global $sess;
- return $sess->close();
-}
-
-function mysess_read() {
- global $sess;
- return $sess->thaw();
-}
-
-function mysess_write() {
- global $sess;
- return $sess->freeze();
-}
-
-function mysess_destroy() {
- global $sess;
- return $sess->delete();
-}
-
-function mysess_gc() {
- global $sess;
- return $sess->gc();
}
?>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]