Index: trunk/phpgwapi/inc/adodb/session/old/adodb-session.php
===================================================================
--- trunk/phpgwapi/inc/adodb/session/old/adodb-session.php	(revision 2)
+++ trunk/phpgwapi/inc/adodb/session/old/adodb-session.php	(revision 34)
@@ -1,5 +1,5 @@
 <?php
 /*
-V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
+V4.93 10 Oct 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
@@ -16,15 +16,14 @@
  =======
  
- 	GLOBAL $HTTP_SESSION_VARS;
 	include('adodb.inc.php');
 	include('adodb-session.php');
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 	
 To force non-persistent connections, call adodb_session_open first before session_start():
 
- 	GLOBAL $HTTP_SESSION_VARS;
 	include('adodb.inc.php');
 	include('adodb-session.php');
@@ -32,6 +31,7 @@
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 
  
@@ -68,5 +68,5 @@
 	$ADODB_SESSION_TBL = 'sessions'
 	
-  3. Recommended is PHP 4.0.6 or later. There are documented
+  3. Recommended is PHP 4.1.0 or later. There are documented
 	 session bugs in earlier versions of PHP.
 
@@ -107,4 +107,35 @@
  /* if database time and system time is difference is greater than this, then give warning */
  define('ADODB_SESSION_SYNCH_SECS',60); 
+
+ /*
+	Thanks Joe Li. See http://phplens.com/lens/lensforum/msgs.php?id=11487&x=1
+*/
+function adodb_session_regenerate_id() 
+{
+	$conn =& ADODB_Session::_conn();
+	if (!$conn) return false;
+
+	$old_id = session_id();
+	if (function_exists('session_regenerate_id')) {
+		session_regenerate_id();
+	} else {
+		session_id(md5(uniqid(rand(), true)));
+		$ck = session_get_cookie_params();
+		setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+		//@session_start();
+	}
+	$new_id = session_id();
+	$ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
+	
+	/* it is possible that the update statement fails due to a collision */
+	if (!$ok) {
+		session_id($old_id);
+		if (empty($ck)) $ck = session_get_cookie_params();
+		setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+		return false;
+	}
+	
+	return true;
+}
 
 /****************************************************************************************\
@@ -194,5 +225,6 @@
 			$ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
 	
-	if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false);
+	if (!$ok) ADOConnection::outp( "
+-- Session: connection failed</p>",false);
 }
 
@@ -253,5 +285,6 @@
 	// now we only update expiry date, thx to sebastian thom in adodb 2.32
 	if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) {
-		if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>";
+		if ($ADODB_SESS_DEBUG) echo "
+-- Session: Only updating date - crc32 not changed</p>";
 		$qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();
 		$rs = $ADODB_SESS_CONN->Execute($qry);	
@@ -270,5 +303,6 @@
 	
 	if (!$rs) {
-		ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);
+		ADOConnection::outp( '
+-- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);
 	}  else {
 		// bug in access driver (could be odbc?) means that info is not commited
@@ -337,5 +371,6 @@
 		$ADODB_SESS_CONN->Execute($qry);
 	
-		if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>");
+		if ($ADODB_SESS_DEBUG) ADOConnection::outp("
+-- <b>Garbage Collection</b>: $qry</p>");
 	}
 	// suggested by Cameron, "GaM3R" <gamr@outworld.cx>
@@ -369,9 +404,10 @@
 	
 		if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
-		global $HTTP_SERVER_VARS;
+		
 			$msg = 
-			__FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
+			__FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
 			error_log($msg);
-			if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");
+			if ($ADODB_SESS_DEBUG) ADOConnection::outp("
+-- $msg</p>");
 		}
 	}
@@ -393,10 +429,10 @@
 
 if (0) {
-GLOBAL $HTTP_SESSION_VARS;
 
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false);
+	$_SESSION['AVAR'] += 1;
+	ADOConnection::outp( "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false);
 }
 
Index: trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php
===================================================================
--- trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php	(revision 2)
+++ trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php	(revision 34)
@@ -1,5 +1,5 @@
 <?php
 /*
-V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
+V4.94 23 Jan 2007  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
@@ -19,5 +19,4 @@
  =======
  
- 	GLOBAL $HTTP_SESSION_VARS;
 	include('adodb.inc.php');
 	#---------------------------------#
@@ -26,6 +25,7 @@
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 
  
@@ -193,5 +193,6 @@
 
 	if (!$rs) {
-		ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);
+		ADOConnection::outp( '
+-- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);
 	} else {
 		// bug in access driver (could be odbc?) means that info is not commited
@@ -264,4 +265,6 @@
 	if (defined('ADODB_SESSION_OPTIMIZE'))
 	{
+	global $ADODB_SESSION_DRIVER;
+	
 		switch( $ADODB_SESSION_DRIVER ) {
 			case 'mysql':
@@ -287,9 +290,9 @@
 		$t = time();
 		if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
-		global $HTTP_SERVER_VARS;
 			$msg = 
-			__FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
+			__FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
 			error_log($msg);
-			if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");
+			if ($ADODB_SESS_DEBUG) ADOConnection::outp("
+-- $msg</p>");
 		}
 	}
@@ -311,10 +314,10 @@
 /*
 if (0) {
-GLOBAL $HTTP_SESSION_VARS;
 
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 }
 */
Index: trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.php
===================================================================
--- trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.php	(revision 2)
+++ trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.php	(revision 34)
@@ -1,5 +1,5 @@
 <?php
 /*
-  V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
+  V4.93 10 Oct 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
@@ -16,15 +16,14 @@
  =======
  
- 	GLOBAL $HTTP_SESSION_VARS;
 	include('adodb.inc.php');
 	include('adodb-session.php');
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 	
 To force non-persistent connections, call adodb_session_open first before session_start():
 
- 	GLOBAL $HTTP_SESSION_VARS;
 	include('adodb.inc.php');
 	include('adodb-session.php');
@@ -32,6 +31,7 @@
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";
+	$_SESSION['AVAR'] += 1;
+	print "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>";
 
  
@@ -58,5 +58,5 @@
 	$ADODB_SESSION_USE_LOBS = false; (or, if you wanna use CLOBS (= 'CLOB') or ( = 'BLOB')
 	
-  3. Recommended is PHP 4.0.6 or later. There are documented
+  3. Recommended is PHP 4.1.0 or later. There are documented
 	 session bugs in earlier versions of PHP.
 
@@ -192,5 +192,6 @@
 			$ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
 	
-	if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false);
+	if (!$ok) ADOConnection::outp( "
+-- Session: connection failed</p>",false);
 }
 
@@ -253,5 +254,6 @@
 	// now we only update expiry date, thx to sebastian thom in adodb 2.32
 	if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) {
-		if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>";
+		if ($ADODB_SESS_DEBUG) echo "
+-- Session: Only updating date - crc32 not changed</p>";
 		$qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();
 		$rs = $ADODB_SESS_CONN->Execute($qry);	
@@ -312,5 +314,6 @@
 
 	if (!$rs) {
-		ADOConnection::outp( '<p>Session Replace: '.nl2br($err).'</p>',false);
+		ADOConnection::outp( '
+-- Session Replace: '.nl2br($err).'</p>',false);
 	}  else {
 		// bug in access driver (could be odbc?) means that info is not commited
@@ -379,5 +382,6 @@
 		$ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time());
 	
-		if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>");
+		if ($ADODB_SESS_DEBUG) ADOConnection::outp("
+-- <b>Garbage Collection</b>: $qry</p>");
 	}
 	// suggested by Cameron, "GaM3R" <gamr@outworld.cx>
@@ -410,9 +414,9 @@
 		$t = time();
 		if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
-		global $HTTP_SERVER_VARS;
 			$msg = 
-			__FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
+			__FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";
 			error_log($msg);
-			if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");
+			if ($ADODB_SESS_DEBUG) ADOConnection::outp("
+-- $msg</p>");
 		}
 	}
@@ -434,10 +438,10 @@
 
 if (0) {
-GLOBAL $HTTP_SESSION_VARS;
 
 	session_start();
 	session_register('AVAR');
-	$HTTP_SESSION_VARS['AVAR'] += 1;
-	ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false);
+	$_SESSION['AVAR'] += 1;
+	ADOConnection::outp( "
+-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false);
 }
 
