From 3f57bd454a346a49cf6e80c1ed6631d887ebef90 Mon Sep 17 00:00:00 2001
From: skodak
Date: Wed, 14 Jan 2009 17:08:29 +0000
Subject: [PATCH] MDL-14992 towards new moodle db sessions
---
admin/multilangupgrade.php | 2 +-
lib/adodb/readme_moodle.txt | 3 +-
lib/adodb/session/adodb-compress-bzip2.php | 118 ---
lib/adodb/session/adodb-compress-gzip.php | 93 --
lib/adodb/session/adodb-cryptsession.php | 27 -
lib/adodb/session/adodb-cryptsession2.php | 27 -
lib/adodb/session/adodb-encrypt-mcrypt.php | 109 --
lib/adodb/session/adodb-encrypt-md5.php | 39 -
lib/adodb/session/adodb-encrypt-secret.php | 48 -
lib/adodb/session/adodb-encrypt-sha1.php | 32 -
lib/adodb/session/adodb-sess.txt | 131 ---
lib/adodb/session/adodb-session-clob.php | 24 -
lib/adodb/session/adodb-session-clob2.php | 24 -
lib/adodb/session/adodb-session.php | 934 -----------------
lib/adodb/session/adodb-session2.php | 947 ------------------
lib/adodb/session/adodb-sessions.mysql.sql | 16 -
.../session/adodb-sessions.oracle.clob.sql | 15 -
lib/adodb/session/adodb-sessions.oracle.sql | 16 -
lib/adodb/session/crypt.inc.php | 161 ---
lib/adodb/session/old/adodb-cryptsession.php | 324 ------
lib/adodb/session/old/adodb-session-clob.php | 448 ---------
lib/adodb/session/old/adodb-session.php | 439 --------
lib/adodb/session/old/crypt.inc.php | 64 --
lib/adodb/session/session_schema.xml | 26 -
lib/adodb/session/session_schema2.xml | 38 -
lib/db/install.xml | 15 +-
lib/db/upgrade.php | 105 +-
lib/simpletestlib.php | 2 +-
version.php | 2 +-
29 files changed, 63 insertions(+), 4166 deletions(-)
delete mode 100644 lib/adodb/session/adodb-compress-bzip2.php
delete mode 100644 lib/adodb/session/adodb-compress-gzip.php
delete mode 100644 lib/adodb/session/adodb-cryptsession.php
delete mode 100644 lib/adodb/session/adodb-cryptsession2.php
delete mode 100644 lib/adodb/session/adodb-encrypt-mcrypt.php
delete mode 100644 lib/adodb/session/adodb-encrypt-md5.php
delete mode 100644 lib/adodb/session/adodb-encrypt-secret.php
delete mode 100644 lib/adodb/session/adodb-encrypt-sha1.php
delete mode 100644 lib/adodb/session/adodb-sess.txt
delete mode 100644 lib/adodb/session/adodb-session-clob.php
delete mode 100644 lib/adodb/session/adodb-session-clob2.php
delete mode 100644 lib/adodb/session/adodb-session.php
delete mode 100644 lib/adodb/session/adodb-session2.php
delete mode 100644 lib/adodb/session/adodb-sessions.mysql.sql
delete mode 100644 lib/adodb/session/adodb-sessions.oracle.clob.sql
delete mode 100644 lib/adodb/session/adodb-sessions.oracle.sql
delete mode 100644 lib/adodb/session/crypt.inc.php
delete mode 100644 lib/adodb/session/old/adodb-cryptsession.php
delete mode 100644 lib/adodb/session/old/adodb-session-clob.php
delete mode 100644 lib/adodb/session/old/adodb-session.php
delete mode 100644 lib/adodb/session/old/crypt.inc.php
delete mode 100644 lib/adodb/session/session_schema.xml
delete mode 100644 lib/adodb/session/session_schema2.xml
diff --git a/admin/multilangupgrade.php b/admin/multilangupgrade.php
index 5bd05248a0..da5ee8a1bc 100644
--- a/admin/multilangupgrade.php
+++ b/admin/multilangupgrade.php
@@ -38,7 +38,7 @@ while(@ob_end_flush());
echo 'Progress:';
$i = 0;
-$skiptables = array('config', 'user_students', 'user_teachers');//, 'sessions2');
+$skiptables = array('config', 'user_students', 'user_teachers');
foreach ($tables as $table) {
if (strpos($table,'pma') === 0) { // Not our tables
diff --git a/lib/adodb/readme_moodle.txt b/lib/adodb/readme_moodle.txt
index bb47c2c061..d530f88977 100644
--- a/lib/adodb/readme_moodle.txt
+++ b/lib/adodb/readme_moodle.txt
@@ -5,6 +5,7 @@ Removed:
* cute_icons_for_site/
* docs/
* pear/
+ * session/
* tests/
* server.php
@@ -25,7 +26,7 @@ Our changes:
not able to return the Insert_ID() at all. MDL-14886.
Reported to ADOdb at: http://phplens.com/lens/lensforum/msgs.php?id=17068
Once fixed by adodb guys, we'll return to their official distro.
-
+
skodak, iarenaza, moodler, stronk7
$Id$
diff --git a/lib/adodb/session/adodb-compress-bzip2.php b/lib/adodb/session/adodb-compress-bzip2.php
deleted file mode 100644
index a820102d2e..0000000000
--- a/lib/adodb/session/adodb-compress-bzip2.php
+++ /dev/null
@@ -1,118 +0,0 @@
-_block_size;
- }
-
- /**
- */
- function setBlockSize($block_size) {
- assert('$block_size >= 1');
- assert('$block_size <= 9');
- $this->_block_size = (int) $block_size;
- }
-
- /**
- */
- function getWorkLevel() {
- return $this->_work_level;
- }
-
- /**
- */
- function setWorkLevel($work_level) {
- assert('$work_level >= 0');
- assert('$work_level <= 250');
- $this->_work_level = (int) $work_level;
- }
-
- /**
- */
- function getMinLength() {
- return $this->_min_length;
- }
-
- /**
- */
- function setMinLength($min_length) {
- assert('$min_length >= 0');
- $this->_min_length = (int) $min_length;
- }
-
- /**
- */
- function ADODB_Compress_Bzip2($block_size = null, $work_level = null, $min_length = null) {
- if (!is_null($block_size)) {
- $this->setBlockSize($block_size);
- }
-
- if (!is_null($work_level)) {
- $this->setWorkLevel($work_level);
- }
-
- if (!is_null($min_length)) {
- $this->setMinLength($min_length);
- }
- }
-
- /**
- */
- function write($data, $key) {
- if (strlen($data) < $this->_min_length) {
- return $data;
- }
-
- if (!is_null($this->_block_size)) {
- if (!is_null($this->_work_level)) {
- return bzcompress($data, $this->_block_size, $this->_work_level);
- } else {
- return bzcompress($data, $this->_block_size);
- }
- }
-
- return bzcompress($data);
- }
-
- /**
- */
- function read($data, $key) {
- return $data ? bzdecompress($data) : $data;
- }
-
-}
-
-return 1;
-
-?>
diff --git a/lib/adodb/session/adodb-compress-gzip.php b/lib/adodb/session/adodb-compress-gzip.php
deleted file mode 100644
index 5bb4e16d37..0000000000
--- a/lib/adodb/session/adodb-compress-gzip.php
+++ /dev/null
@@ -1,93 +0,0 @@
-_level;
- }
-
- /**
- */
- function setLevel($level) {
- assert('$level >= 0');
- assert('$level <= 9');
- $this->_level = (int) $level;
- }
-
- /**
- */
- function getMinLength() {
- return $this->_min_length;
- }
-
- /**
- */
- function setMinLength($min_length) {
- assert('$min_length >= 0');
- $this->_min_length = (int) $min_length;
- }
-
- /**
- */
- function ADODB_Compress_Gzip($level = null, $min_length = null) {
- if (!is_null($level)) {
- $this->setLevel($level);
- }
-
- if (!is_null($min_length)) {
- $this->setMinLength($min_length);
- }
- }
-
- /**
- */
- function write($data, $key) {
- if (strlen($data) < $this->_min_length) {
- return $data;
- }
-
- if (!is_null($this->_level)) {
- return gzcompress($data, $this->_level);
- } else {
- return gzcompress($data);
- }
- }
-
- /**
- */
- function read($data, $key) {
- return $data ? gzuncompress($data) : $data;
- }
-
-}
-
-return 1;
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-cryptsession.php b/lib/adodb/session/adodb-cryptsession.php
deleted file mode 100644
index b9cde1fbd7..0000000000
--- a/lib/adodb/session/adodb-cryptsession.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-cryptsession2.php b/lib/adodb/session/adodb-cryptsession2.php
deleted file mode 100644
index 07e2943150..0000000000
--- a/lib/adodb/session/adodb-cryptsession2.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-encrypt-mcrypt.php b/lib/adodb/session/adodb-encrypt-mcrypt.php
deleted file mode 100644
index ea57ef4a2b..0000000000
--- a/lib/adodb/session/adodb-encrypt-mcrypt.php
+++ /dev/null
@@ -1,109 +0,0 @@
-_cipher;
- }
-
- /**
- */
- function setCipher($cipher) {
- $this->_cipher = $cipher;
- }
-
- /**
- */
- function getMode() {
- return $this->_mode;
- }
-
- /**
- */
- function setMode($mode) {
- $this->_mode = $mode;
- }
-
- /**
- */
- function getSource() {
- return $this->_source;
- }
-
- /**
- */
- function setSource($source) {
- $this->_source = $source;
- }
-
- /**
- */
- function ADODB_Encrypt_MCrypt($cipher = null, $mode = null, $source = null) {
- if (!$cipher) {
- $cipher = MCRYPT_RIJNDAEL_256;
- }
- if (!$mode) {
- $mode = MCRYPT_MODE_ECB;
- }
- if (!$source) {
- $source = MCRYPT_RAND;
- }
-
- $this->_cipher = $cipher;
- $this->_mode = $mode;
- $this->_source = $source;
- }
-
- /**
- */
- function write($data, $key) {
- $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
- $iv = mcrypt_create_iv($iv_size, $this->_source);
- return mcrypt_encrypt($this->_cipher, $key, $data, $this->_mode, $iv);
- }
-
- /**
- */
- function read($data, $key) {
- $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
- $iv = mcrypt_create_iv($iv_size, $this->_source);
- $rv = mcrypt_decrypt($this->_cipher, $key, $data, $this->_mode, $iv);
- return rtrim($rv, "\0");
- }
-
-}
-
-return 1;
-
-?>
diff --git a/lib/adodb/session/adodb-encrypt-md5.php b/lib/adodb/session/adodb-encrypt-md5.php
deleted file mode 100644
index 04a74781c5..0000000000
--- a/lib/adodb/session/adodb-encrypt-md5.php
+++ /dev/null
@@ -1,39 +0,0 @@
-encrypt($data, $key);
- }
-
- /**
- */
- function read($data, $key) {
- $md5crypt = new MD5Crypt();
- return $md5crypt->decrypt($data, $key);
- }
-
-}
-
-return 1;
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-encrypt-secret.php b/lib/adodb/session/adodb-encrypt-secret.php
deleted file mode 100644
index b3b89cad2a..0000000000
--- a/lib/adodb/session/adodb-encrypt-secret.php
+++ /dev/null
@@ -1,48 +0,0 @@
-
diff --git a/lib/adodb/session/adodb-encrypt-sha1.php b/lib/adodb/session/adodb-encrypt-sha1.php
deleted file mode 100644
index 16f603e339..0000000000
--- a/lib/adodb/session/adodb-encrypt-sha1.php
+++ /dev/null
@@ -1,32 +0,0 @@
-encrypt($data, $key);
-
- }
-
-
- function read($data, $key)
- {
- $sha1crypt = new SHA1Crypt();
- return $sha1crypt->decrypt($data, $key);
-
- }
-}
-
-
-
-return 1;
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-sess.txt b/lib/adodb/session/adodb-sess.txt
deleted file mode 100644
index d23dac42df..0000000000
--- a/lib/adodb/session/adodb-sess.txt
+++ /dev/null
@@ -1,131 +0,0 @@
-John,
-
-I have been an extremely satisfied ADODB user for several years now.
-
-To give you something back for all your hard work, I've spent the last 3
-days rewriting the adodb-session.php code.
-
-----------
-What's New
-----------
-
-Here's a list of the new code's benefits:
-
-* Combines the functionality of the three files:
-
-adodb-session.php
-adodb-session-clob.php
-adodb-cryptsession.php
-
-each with very similar functionality, into a single file adodb-session.php.
-This will ease maintenance and support issues.
-
-* Supports multiple encryption and compression schemes.
- Currently, we support:
-
- MD5Crypt (crypt.inc.php)
- MCrypt
- Secure (Horde's emulation of MCrypt, if MCrypt module is not available.)
- GZip
- BZip2
-
-These can be stacked, so if you want to compress and then encrypt your
-session data, it's easy.
-Also, the built-in MCrypt functions will be *much* faster, and more secure,
-than the MD5Crypt code.
-
-* adodb-session.php contains a single class ADODB_Session that encapsulates
-all functionality.
- This eliminates the use of global vars and defines (though they are
-supported for backwards compatibility).
-
-* All user defined parameters are now static functions in the ADODB_Session
-class.
-
-New parameters include:
-
-* encryptionKey(): Define the encryption key used to encrypt the session.
-Originally, it was a hard coded string.
-
-* persist(): Define if the database will be opened in persistent mode.
-Originally, the user had to call adodb_sess_open().
-
-* dataFieldName(): Define the field name used to store the session data, as
-'DATA' appears to be a reserved word in the following cases:
- ANSI SQL
- IBM DB2
- MS SQL Server
- Postgres
- SAP
-
-* filter(): Used to support multiple, simulataneous encryption/compression
-schemes.
-
-* Debug support is improved thru _rsdump() function, which is called after
-every database call.
-
-------------
-What's Fixed
-------------
-
-The new code includes several bug fixes and enhancements:
-
-* sesskey is compared in BINARY mode for MySQL, to avoid problems with
-session keys that differ only by case.
- Of course, the user should define the sesskey field as BINARY, to
-correctly fix this problem, otherwise performance will suffer.
-
-* In ADODB_Session::gc(), if $expire_notify is true, the multiple DELETES in
-the original code have been optimized to a single DELETE.
-
-* In ADODB_Session::destroy(), since "SELECT expireref, sesskey FROM $table
-WHERE sesskey = $qkey" will only return a single value, we don't loop on the
-result, we simply process the row, if any.
-
-* We close $rs after every use.
-
----------------
-What's the Same
----------------
-
-I know backwards compatibility is *very* important to you. Therefore, the
-new code is 100% backwards compatible.
-
-If you like my code, but don't "trust" it's backwards compatible, maybe we
-offer it as beta code, in a new directory for a release or two?
-
-------------
-What's To Do
-------------
-
-I've vascillated over whether to use a single function to get/set
-parameters:
-
-$user = ADODB_Session::user(); // get
-ADODB_Session::user($user); // set
-
-or to use separate functions (which is the PEAR/Java way):
-
-$user = ADODB_Session::getUser();
-ADODB_Session::setUser($user);
-
-I've chosen the former as it's makes for a simpler API, and reduces the
-amount of code, but I'd be happy to change it to the latter.
-
-Also, do you think the class should be a singleton class, versus a static
-class?
-
-Let me know if you find this code useful, and will be including it in the
-next release of ADODB.
-
-If so, I will modify the current documentation to detail the new
-functionality. To that end, what file(s) contain the documentation? Please
-send them to me if they are not publically available.
-
-Also, if there is *anything* in the code that you like to see changed, let
-me know.
-
-Thanks,
-
-Ross
-
diff --git a/lib/adodb/session/adodb-session-clob.php b/lib/adodb/session/adodb-session-clob.php
deleted file mode 100644
index 603e3d15e5..0000000000
--- a/lib/adodb/session/adodb-session-clob.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-session-clob2.php b/lib/adodb/session/adodb-session-clob2.php
deleted file mode 100644
index c9f39afae5..0000000000
--- a/lib/adodb/session/adodb-session-clob2.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-session.php b/lib/adodb/session/adodb-session.php
deleted file mode 100644
index 94ebf99600..0000000000
--- a/lib/adodb/session/adodb-session.php
+++ /dev/null
@@ -1,934 +0,0 @@
-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;
-}
-
-/*
- Generate database table for session data
- @see http://phplens.com/lens/lensforum/msgs.php?id=12280
- @return 0 if failure, 1 if errors, 2 if successful.
- @author Markus Staab http://www.public-4u.de
-*/
-function adodb_session_create_table($schemaFile=null,$conn = null)
-{
- // set default values
- if ($schemaFile===null) $schemaFile = ADODB_SESSION . '/session_schema.xml';
- if ($conn===null) $conn = ADODB_Session::_conn();
-
- if (!$conn) return 0;
-
- $schema = new adoSchema($conn);
- $schema->ParseSchema($schemaFile);
- return $schema->ExecuteSchema();
-}
-
-/*!
- \static
-*/
-class ADODB_Session {
- /////////////////////
- // getter/setter methods
- /////////////////////
-
- /*
-
- function Lock($lock=null)
- {
- static $_lock = false;
-
- if (!is_null($lock)) $_lock = $lock;
- return $lock;
- }
- */
- /*!
- */
- function driver($driver = null) {
- static $_driver = 'mysql';
- static $set = false;
-
- if (!is_null($driver)) {
- $_driver = trim($driver);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_DRIVER'])) {
- return $GLOBALS['ADODB_SESSION_DRIVER'];
- }
- }
-
- return $_driver;
- }
-
- /*!
- */
- function host($host = null) {
- static $_host = 'localhost';
- static $set = false;
-
- if (!is_null($host)) {
- $_host = trim($host);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_CONNECT'])) {
- return $GLOBALS['ADODB_SESSION_CONNECT'];
- }
- }
-
- return $_host;
- }
-
- /*!
- */
- function user($user = null) {
- static $_user = 'root';
- static $set = false;
-
- if (!is_null($user)) {
- $_user = trim($user);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_USER'])) {
- return $GLOBALS['ADODB_SESSION_USER'];
- }
- }
-
- return $_user;
- }
-
- /*!
- */
- function password($password = null) {
- static $_password = '';
- static $set = false;
-
- if (!is_null($password)) {
- $_password = $password;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_PWD'])) {
- return $GLOBALS['ADODB_SESSION_PWD'];
- }
- }
-
- return $_password;
- }
-
- /*!
- */
- function database($database = null) {
- static $_database = 'xphplens_2';
- static $set = false;
-
- if (!is_null($database)) {
- $_database = trim($database);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_DB'])) {
- return $GLOBALS['ADODB_SESSION_DB'];
- }
- }
-
- return $_database;
- }
-
- /*!
- */
- function persist($persist = null)
- {
- static $_persist = true;
-
- if (!is_null($persist)) {
- $_persist = trim($persist);
- }
-
- return $_persist;
- }
-
- /*!
- */
- function lifetime($lifetime = null) {
- static $_lifetime;
- static $set = false;
-
- if (!is_null($lifetime)) {
- $_lifetime = (int) $lifetime;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESS_LIFE'])) {
- return $GLOBALS['ADODB_SESS_LIFE'];
- }
- }
- if (!$_lifetime) {
- $_lifetime = ini_get('session.gc_maxlifetime');
- if ($_lifetime <= 1) {
- // bug in PHP 4.0.3 pl 1 -- how about other versions?
- //print "Session Error: PHP.INI setting session.gc_maxlifetimenot set: $lifetime
";
- $_lifetime = 1440;
- }
- }
-
- return $_lifetime;
- }
-
- /*!
- */
- function debug($debug = null) {
- static $_debug = false;
- static $set = false;
-
- if (!is_null($debug)) {
- $_debug = (bool) $debug;
-
- $conn = ADODB_Session::_conn();
- if ($conn) {
- $conn->debug = $_debug;
- }
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESS_DEBUG'])) {
- return $GLOBALS['ADODB_SESS_DEBUG'];
- }
- }
-
- return $_debug;
- }
-
- /*!
- */
- function expireNotify($expire_notify = null) {
- static $_expire_notify;
- static $set = false;
-
- if (!is_null($expire_notify)) {
- $_expire_notify = $expire_notify;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'])) {
- return $GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'];
- }
- }
-
- return $_expire_notify;
- }
-
- /*!
- */
- function table($table = null) {
- static $_table = 'sessions';
- static $set = false;
-
- if (!is_null($table)) {
- $_table = trim($table);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_TBL'])) {
- return $GLOBALS['ADODB_SESSION_TBL'];
- }
- }
-
- return $_table;
- }
-
- /*!
- */
- function optimize($optimize = null) {
- static $_optimize = false;
- static $set = false;
-
- if (!is_null($optimize)) {
- $_optimize = (bool) $optimize;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (defined('ADODB_SESSION_OPTIMIZE')) {
- return true;
- }
- }
-
- return $_optimize;
- }
-
- /*!
- */
- function syncSeconds($sync_seconds = null) {
- static $_sync_seconds = 60;
- static $set = false;
-
- if (!is_null($sync_seconds)) {
- $_sync_seconds = (int) $sync_seconds;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (defined('ADODB_SESSION_SYNCH_SECS')) {
- return ADODB_SESSION_SYNCH_SECS;
- }
- }
-
- return $_sync_seconds;
- }
-
- /*!
- */
- function clob($clob = null) {
- static $_clob = false;
- static $set = false;
-
- if (!is_null($clob)) {
- $_clob = strtolower(trim($clob));
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_USE_LOBS'])) {
- return $GLOBALS['ADODB_SESSION_USE_LOBS'];
- }
- }
-
- return $_clob;
- }
-
- /*!
- */
- function dataFieldName($data_field_name = null) {
- static $_data_field_name = 'data';
-
- if (!is_null($data_field_name)) {
- $_data_field_name = trim($data_field_name);
- }
-
- return $_data_field_name;
- }
-
- /*!
- */
- function filter($filter = null) {
- static $_filter = array();
-
- if (!is_null($filter)) {
- if (!is_array($filter)) {
- $filter = array($filter);
- }
- $_filter = $filter;
- }
-
- return $_filter;
- }
-
- /*!
- */
- function encryptionKey($encryption_key = null) {
- static $_encryption_key = 'CRYPTED ADODB SESSIONS ROCK!';
-
- if (!is_null($encryption_key)) {
- $_encryption_key = $encryption_key;
- }
-
- return $_encryption_key;
- }
-
- /////////////////////
- // private methods
- /////////////////////
-
- /*!
- */
- function _conn($conn=null) {
- return $GLOBALS['ADODB_SESS_CONN'];
- }
-
- /*!
- */
- function _crc($crc = null) {
- static $_crc = false;
-
- if (!is_null($crc)) {
- $_crc = $crc;
- }
-
- return $_crc;
- }
-
- /*!
- */
- function _init() {
- session_module_name('user');
- session_set_save_handler(
- array('ADODB_Session', 'open'),
- array('ADODB_Session', 'close'),
- array('ADODB_Session', 'read'),
- array('ADODB_Session', 'write'),
- array('ADODB_Session', 'destroy'),
- array('ADODB_Session', 'gc')
- );
- }
-
-
- /*!
- */
- function _sessionKey() {
- // use this function to create the encryption key for crypted sessions
- // crypt the used key, ADODB_Session::encryptionKey() as key and session_id() as salt
- return crypt(ADODB_Session::encryptionKey(), session_id());
- }
-
- /*!
- */
- function _dumprs($rs) {
- $conn = ADODB_Session::_conn();
- $debug = ADODB_Session::debug();
-
- if (!$conn) {
- return;
- }
-
- if (!$debug) {
- return;
- }
-
- if (!$rs) {
- echo "
\$rs is null or false
\n";
- return;
- }
-
- //echo "
\nAffected_Rows=",$conn->Affected_Rows(),"
\n";
-
- if (!is_object($rs)) {
- return;
- }
-
- require_once ADODB_SESSION.'/../tohtml.inc.php';
- rs2html($rs);
- }
-
- /////////////////////
- // public methods
- /////////////////////
-
- function config($driver, $host, $user, $password, $database=false,$options=false)
- {
- ADODB_Session::driver($driver);
- ADODB_Session::host($host);
- ADODB_Session::user($user);
- ADODB_Session::password($password);
- ADODB_Session::database($database);
-
- if ($driver == 'oci8' || $driver == 'oci8po') $options['lob'] = 'CLOB';
-
- if (isset($options['table'])) ADODB_Session::table($options['table']);
- if (isset($options['lob'])) ADODB_Session::clob($options['lob']);
- if (isset($options['debug'])) ADODB_Session::debug($options['debug']);
- }
-
- /*!
- Create the connection to the database.
-
- If $conn already exists, reuse that connection
- */
- function open($save_path, $session_name, $persist = null)
- {
- $conn = ADODB_Session::_conn();
-
- if ($conn) {
- return true;
- }
-
- $database = ADODB_Session::database();
- $debug = ADODB_Session::debug();
- $driver = ADODB_Session::driver();
- $host = ADODB_Session::host();
- $password = ADODB_Session::password();
- $user = ADODB_Session::user();
-
- if (!is_null($persist)) {
- ADODB_Session::persist($persist);
- } else {
- $persist = ADODB_Session::persist();
- }
-
-# these can all be defaulted to in php.ini
-# assert('$database');
-# assert('$driver');
-# assert('$host');
-
- $conn = ADONewConnection($driver);
-
- if ($debug) {
- $conn->debug = true;
-// ADOConnection::outp( " driver=$driver user=$user pwd=$password db=$database ");
- }
-
- if ($persist) {
- switch($persist) {
- default:
- case 'P': $ok = $conn->PConnect($host, $user, $password, $database); break;
- case 'C': $ok = $conn->Connect($host, $user, $password, $database); break;
- case 'N': $ok = $conn->NConnect($host, $user, $password, $database); break;
- }
- } else {
- $ok = $conn->Connect($host, $user, $password, $database);
- }
-
- if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
- else
- ADOConnection::outp('Session: connection failed
', false);
-
-
- return $ok;
- }
-
- /*!
- Close the connection
- */
- function close()
- {
-/*
- $conn = ADODB_Session::_conn();
- if ($conn) $conn->Close();
-*/
- return true;
- }
-
- /*
- Slurp in the session variables and return the serialized string
- */
- function read($key)
- {
- $conn = ADODB_Session::_conn();
- $data = ADODB_Session::dataFieldName();
- $filter = ADODB_Session::filter();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return '';
- }
-
- //assert('$table');
-
- $qkey = $conn->quote($key);
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- $sql = "SELECT $data FROM $table WHERE sesskey = $binary $qkey AND expiry >= " . time();
- /* Lock code does not work as it needs to hold transaction within whole page, and we don't know if
- developer has commited elsewhere... :(
- */
- #if (ADODB_Session::Lock())
- # $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), $data);
- #else
-
- $rs = $conn->Execute($sql);
- //ADODB_Session::_dumprs($rs);
- if ($rs) {
- if ($rs->EOF) {
- $v = '';
- } else {
- $v = reset($rs->fields);
- $filter = array_reverse($filter);
- foreach ($filter as $f) {
- if (is_object($f)) {
- $v = $f->read($v, ADODB_Session::_sessionKey());
- }
- }
- $v = rawurldecode($v);
- }
-
- $rs->Close();
-
- ADODB_Session::_crc(strlen($v) . crc32($v));
- return $v;
- }
-
- return '';
- }
-
- /*!
- Write the serialized data to a database.
-
- If the data has not been modified since the last read(), we do not write.
- */
- function write($key, $val)
- {
- global $ADODB_SESSION_READONLY;
-
- if (!empty($ADODB_SESSION_READONLY)) return;
-
- $clob = ADODB_Session::clob();
- $conn = ADODB_Session::_conn();
- $crc = ADODB_Session::_crc();
- $data = ADODB_Session::dataFieldName();
- $debug = ADODB_Session::debug();
- $driver = ADODB_Session::driver();
- $expire_notify = ADODB_Session::expireNotify();
- $filter = ADODB_Session::filter();
- $lifetime = ADODB_Session::lifetime();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return false;
- }
- $qkey = $conn->qstr($key);
-
- //assert('$table');
-
- $expiry = time() + $lifetime;
-
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- // crc32 optimization since adodb 2.1
- // now we only update expiry date, thx to sebastian thom in adodb 2.32
- if ($crc !== false && $crc == (strlen($val) . crc32($val))) {
- if ($debug) {
- ADOConnection::outp( 'Session: Only updating date - crc32 not changed
');
- }
-
- $expirevar = '';
- if ($expire_notify) {
- $var = reset($expire_notify);
- global $$var;
- if (isset($$var)) {
- $expirevar = $$var;
- }
- }
-
-
- $sql = "UPDATE $table SET expiry = ".$conn->Param('0').",expireref=".$conn->Param('1')." WHERE $binary sesskey = ".$conn->Param('2')." AND expiry >= ".$conn->Param('3');
- $rs = $conn->Execute($sql,array($expiry,$expirevar,$key,time()));
- return true;
- }
- $val = rawurlencode($val);
- foreach ($filter as $f) {
- if (is_object($f)) {
- $val = $f->write($val, ADODB_Session::_sessionKey());
- }
- }
-
- $arr = array('sesskey' => $key, 'expiry' => $expiry, $data => $val, 'expireref' => '');
- if ($expire_notify) {
- $var = reset($expire_notify);
- global $$var;
- if (isset($$var)) {
- $arr['expireref'] = $$var;
- }
- }
-
- if (!$clob) { // no lobs, simply use replace()
- $arr[$data] = $conn->qstr($val);
- $rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
-
- } else {
- // what value shall we insert/update for lob row?
- switch ($driver) {
- // empty_clob or empty_lob for oracle dbs
- case 'oracle':
- case 'oci8':
- case 'oci8po':
- case 'oci805':
- $lob_value = sprintf('empty_%s()', strtolower($clob));
- break;
-
- // null for all other
- default:
- $lob_value = 'null';
- break;
- }
-
- $conn->StartTrans();
- $expiryref = $conn->qstr($arr['expireref']);
- // do we insert or update? => as for sesskey
- $rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = $qkey");
- if ($rs && reset($rs->fields) > 0) {
- $sql = "UPDATE $table SET expiry = $expiry, $data = $lob_value, expireref=$expiryref WHERE sesskey = $qkey";
- } else {
- $sql = "INSERT INTO $table (expiry, $data, sesskey,expireref) VALUES ($expiry, $lob_value, $qkey,$expiryref)";
- }
- if ($rs)$rs->Close();
-
-
- $err = '';
- $rs1 = $conn->Execute($sql);
- if (!$rs1) $err = $conn->ErrorMsg()."\n";
-
- $rs2 = $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
- if (!$rs2) $err .= $conn->ErrorMsg()."\n";
-
- $rs = ($rs && $rs2) ? true : false;
- $conn->CompleteTrans();
- }
-
- if (!$rs) {
- ADOConnection::outp('Session Replace: ' . $conn->ErrorMsg() . '
', false);
- return false;
- } else {
- // bug in access driver (could be odbc?) means that info is not committed
- // properly unless select statement executed in Win2000
- if ($conn->databaseType == 'access') {
- $sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- if ($rs) {
- $rs->Close();
- }
- }
- }/*
- if (ADODB_Session::Lock()) {
- $conn->CommitTrans();
- }*/
- return $rs ? true : false;
- }
-
- /*!
- */
- function destroy($key) {
- $conn = ADODB_Session::_conn();
- $table = ADODB_Session::table();
- $expire_notify = ADODB_Session::expireNotify();
-
- if (!$conn) {
- return false;
- }
-
- //assert('$table');
-
- $qkey = $conn->quote($key);
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- if ($expire_notify) {
- reset($expire_notify);
- $fn = next($expire_notify);
- $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
- $sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- $conn->SetFetchMode($savem);
- if (!$rs) {
- return false;
- }
- if (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- //assert('$ref');
- //assert('$key');
- $fn($ref, $key);
- }
- $rs->Close();
- }
-
- $sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
-
- return $rs ? true : false;
- }
-
- /*!
- */
- function gc($maxlifetime)
- {
- $conn = ADODB_Session::_conn();
- $debug = ADODB_Session::debug();
- $expire_notify = ADODB_Session::expireNotify();
- $optimize = ADODB_Session::optimize();
- $sync_seconds = ADODB_Session::syncSeconds();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return false;
- }
-
-
- $time = time();
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- if ($expire_notify) {
- reset($expire_notify);
- $fn = next($expire_notify);
- $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
- $sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- $conn->SetFetchMode($savem);
- if ($rs) {
- $conn->StartTrans();
- $keys = array();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref, $key);
- $del = $conn->Execute("DELETE FROM $table WHERE sesskey=".$conn->Param('0'),array($key));
- $rs->MoveNext();
- }
- $rs->Close();
-
- $conn->CompleteTrans();
- }
- } else {
-
- if (1) {
- $sql = "SELECT sesskey FROM $table WHERE expiry < $time";
- $arr = $conn->GetAll($sql);
- foreach ($arr as $row) {
- $sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
- $conn->Execute($sql2,array($row[0]));
- }
- } else {
- $sql = "DELETE FROM $table WHERE expiry < $time";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- if ($rs) $rs->Close();
- }
- if ($debug) {
- ADOConnection::outp("Garbage Collection: $sql
");
- }
- }
-
- // suggested by Cameron, "GaM3R"
- if ($optimize) {
- $driver = ADODB_Session::driver();
-
- if (preg_match('/mysql/i', $driver)) {
- $sql = "OPTIMIZE TABLE $table";
- }
- if (preg_match('/postgres/i', $driver)) {
- $sql = "VACUUM $table";
- }
- if (!empty($sql)) {
- $conn->Execute($sql);
- }
- }
-
- if ($sync_seconds) {
- $sql = 'SELECT ';
- if ($conn->dataProvider === 'oci8') {
- $sql .= "TO_CHAR({$conn->sysTimeStamp}, 'RRRR-MM-DD HH24:MI:SS')";
- } else {
- $sql .= $conn->sysTimeStamp;
- }
- $sql .= " FROM $table";
-
- $rs = $conn->SelectLimit($sql, 1);
- if ($rs && !$rs->EOF) {
- $dbts = reset($rs->fields);
- $rs->Close();
- $dbt = $conn->UnixTimeStamp($dbts);
- $t = time();
-
- if (abs($dbt - $t) >= $sync_seconds) {
- $msg = __FILE__ .
- ": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: " .
- " database=$dbt ($dbts), webserver=$t (diff=". (abs($dbt - $t) / 60) . ' minutes)';
- error_log($msg);
- if ($debug) {
- ADOConnection::outp("$msg
");
- }
- }
- }
- }
-
- return true;
- }
-}
-
-ADODB_Session::_init();
-if (empty($ADODB_SESSION_READONLY))
- register_shutdown_function('session_write_close');
-
-// for backwards compatability only
-function adodb_sess_open($save_path, $session_name, $persist = true) {
- return ADODB_Session::open($save_path, $session_name, $persist);
-}
-
-// for backwards compatability only
-function adodb_sess_gc($t)
-{
- return ADODB_Session::gc($t);
-}
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-session2.php b/lib/adodb/session/adodb-session2.php
deleted file mode 100644
index e853933e98..0000000000
--- a/lib/adodb/session/adodb-session2.php
+++ /dev/null
@@ -1,947 +0,0 @@
-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;
-}
-
-/*
- Generate database table for session data
- @see http://phplens.com/lens/lensforum/msgs.php?id=12280
- @return 0 if failure, 1 if errors, 2 if successful.
- @author Markus Staab http://www.public-4u.de
-*/
-function adodb_session_create_table($schemaFile=null,$conn = null)
-{
- // set default values
- if ($schemaFile===null) $schemaFile = ADODB_SESSION . '/session_schema2.xml';
- if ($conn===null) $conn = ADODB_Session::_conn();
-
- if (!$conn) return 0;
-
- $schema = new adoSchema($conn);
- $schema->ParseSchema($schemaFile);
- return $schema->ExecuteSchema();
-}
-
-/*!
- \static
-*/
-class ADODB_Session {
- /////////////////////
- // getter/setter methods
- /////////////////////
-
- /*
-
- function Lock($lock=null)
- {
- static $_lock = false;
-
- if (!is_null($lock)) $_lock = $lock;
- return $lock;
- }
- */
- /*!
- */
- static function driver($driver = null)
- {
- static $_driver = 'mysql';
- static $set = false;
-
- if (!is_null($driver)) {
- $_driver = trim($driver);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_DRIVER'])) {
- return $GLOBALS['ADODB_SESSION_DRIVER'];
- }
- }
-
- return $_driver;
- }
-
- /*!
- */
- static function host($host = null) {
- static $_host = 'localhost';
- static $set = false;
-
- if (!is_null($host)) {
- $_host = trim($host);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_CONNECT'])) {
- return $GLOBALS['ADODB_SESSION_CONNECT'];
- }
- }
-
- return $_host;
- }
-
- /*!
- */
- static function user($user = null)
- {
- static $_user = 'root';
- static $set = false;
-
- if (!is_null($user)) {
- $_user = trim($user);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_USER'])) {
- return $GLOBALS['ADODB_SESSION_USER'];
- }
- }
-
- return $_user;
- }
-
- /*!
- */
- static function password($password = null)
- {
- static $_password = '';
- static $set = false;
-
- if (!is_null($password)) {
- $_password = $password;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_PWD'])) {
- return $GLOBALS['ADODB_SESSION_PWD'];
- }
- }
-
- return $_password;
- }
-
- /*!
- */
- static function database($database = null)
- {
- static $_database = '';
- static $set = false;
-
- if (!is_null($database)) {
- $_database = trim($database);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_DB'])) {
- return $GLOBALS['ADODB_SESSION_DB'];
- }
- }
- return $_database;
- }
-
- /*!
- */
- static function persist($persist = null)
- {
- static $_persist = true;
-
- if (!is_null($persist)) {
- $_persist = trim($persist);
- }
-
- return $_persist;
- }
-
- /*!
- */
- static function lifetime($lifetime = null)
- {
- static $_lifetime;
- static $set = false;
-
- if (!is_null($lifetime)) {
- $_lifetime = (int) $lifetime;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESS_LIFE'])) {
- return $GLOBALS['ADODB_SESS_LIFE'];
- }
- }
- if (!$_lifetime) {
- $_lifetime = ini_get('session.gc_maxlifetime');
- if ($_lifetime <= 1) {
- // bug in PHP 4.0.3 pl 1 -- how about other versions?
- //print "Session Error: PHP.INI setting session.gc_maxlifetimenot set: $lifetime
";
- $_lifetime = 1440;
- }
- }
-
- return $_lifetime;
- }
-
- /*!
- */
- static function debug($debug = null)
- {
- static $_debug = false;
- static $set = false;
-
- if (!is_null($debug)) {
- $_debug = (bool) $debug;
-
- $conn = ADODB_Session::_conn();
- if ($conn) {
- #$conn->debug = $_debug;
- }
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESS_DEBUG'])) {
- return $GLOBALS['ADODB_SESS_DEBUG'];
- }
- }
-
- return $_debug;
- }
-
- /*!
- */
- static function expireNotify($expire_notify = null)
- {
- static $_expire_notify;
- static $set = false;
-
- if (!is_null($expire_notify)) {
- $_expire_notify = $expire_notify;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'])) {
- return $GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'];
- }
- }
-
- return $_expire_notify;
- }
-
- /*!
- */
- static function table($table = null)
- {
- static $_table = 'sessions2';
- static $set = false;
-
- if (!is_null($table)) {
- $_table = trim($table);
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_TBL'])) {
- return $GLOBALS['ADODB_SESSION_TBL'];
- }
- }
-
- return $_table;
- }
-
- /*!
- */
- static function optimize($optimize = null)
- {
- static $_optimize = false;
- static $set = false;
-
- if (!is_null($optimize)) {
- $_optimize = (bool) $optimize;
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (defined('ADODB_SESSION_OPTIMIZE')) {
- return true;
- }
- }
-
- return $_optimize;
- }
-
- /*!
- */
- static function syncSeconds($sync_seconds = null) {
- //echo ("WARNING: ADODB_SESSION::syncSeconds is longer used, please remove this function for your code
");
-
- return 0;
- }
-
- /*!
- */
- static function clob($clob = null) {
- static $_clob = false;
- static $set = false;
-
- if (!is_null($clob)) {
- $_clob = strtolower(trim($clob));
- $set = true;
- } elseif (!$set) {
- // backwards compatibility
- if (isset($GLOBALS['ADODB_SESSION_USE_LOBS'])) {
- return $GLOBALS['ADODB_SESSION_USE_LOBS'];
- }
- }
-
- return $_clob;
- }
-
- /*!
- */
- static function dataFieldName($data_field_name = null) {
- //echo ("WARNING: ADODB_SESSION::dataFieldName() is longer used, please remove this function for your code
");
- return '';
- }
-
- /*!
- */
- static function filter($filter = null) {
- static $_filter = array();
-
- if (!is_null($filter)) {
- if (!is_array($filter)) {
- $filter = array($filter);
- }
- $_filter = $filter;
- }
-
- return $_filter;
- }
-
- /*!
- */
- static function encryptionKey($encryption_key = null) {
- static $_encryption_key = 'CRYPTED ADODB SESSIONS ROCK!';
-
- if (!is_null($encryption_key)) {
- $_encryption_key = $encryption_key;
- }
-
- return $_encryption_key;
- }
-
- /////////////////////
- // private methods
- /////////////////////
-
- /*!
- */
- static function _conn($conn=null) {
- return @$GLOBALS['ADODB_SESS_CONN'];
- }
-
- /*!
- */
- static function _crc($crc = null) {
- static $_crc = false;
-
- if (!is_null($crc)) {
- $_crc = $crc;
- }
-
- return $_crc;
- }
-
- /*!
- */
- static function _init() {
- session_module_name('user');
- session_set_save_handler(
- array('ADODB_Session', 'open'),
- array('ADODB_Session', 'close'),
- array('ADODB_Session', 'read'),
- array('ADODB_Session', 'write'),
- array('ADODB_Session', 'destroy'),
- array('ADODB_Session', 'gc')
- );
- }
-
-
- /*!
- */
- static function _sessionKey() {
- // use this function to create the encryption key for crypted sessions
- // crypt the used key, ADODB_Session::encryptionKey() as key and session_id() as salt
- return crypt(ADODB_Session::encryptionKey(), session_id());
- }
-
- /*!
- */
- static function _dumprs($rs) {
- $conn = ADODB_Session::_conn();
- $debug = ADODB_Session::debug();
-
- if (!$conn) {
- return;
- }
-
- if (!$debug) {
- return;
- }
-
- if (!$rs) {
- echo "
\$rs is null or false
\n";
- return;
- }
-
- //echo "
\nAffected_Rows=",$conn->Affected_Rows(),"
\n";
-
- if (!is_object($rs)) {
- return;
- }
-
- require_once ADODB_SESSION.'/../tohtml.inc.php';
- rs2html($rs);
- }
-
- /////////////////////
- // public methods
- /////////////////////
-
- static function config($driver, $host, $user, $password, $database=false,$options=false)
- {
- ADODB_Session::driver($driver);
- ADODB_Session::host($host);
- ADODB_Session::user($user);
- ADODB_Session::password($password);
- ADODB_Session::database($database);
-
- if ($driver == 'oci8' || $driver == 'oci8po') $options['lob'] = 'CLOB';
-
- if (isset($options['table'])) ADODB_Session::table($options['table']);
- if (isset($options['lob'])) ADODB_Session::clob($options['lob']);
- if (isset($options['debug'])) ADODB_Session::debug($options['debug']);
- }
-
- /*!
- Create the connection to the database.
-
- If $conn already exists, reuse that connection
- */
- static function open($save_path, $session_name, $persist = null)
- {
- $conn = ADODB_Session::_conn();
-
- if ($conn) {
- return true;
- }
-
- $database = ADODB_Session::database();
- $debug = ADODB_Session::debug();
- $driver = ADODB_Session::driver();
- $host = ADODB_Session::host();
- $password = ADODB_Session::password();
- $user = ADODB_Session::user();
-
- if (!is_null($persist)) {
- ADODB_Session::persist($persist);
- } else {
- $persist = ADODB_Session::persist();
- }
-
-# these can all be defaulted to in php.ini
-# assert('$database');
-# assert('$driver');
-# assert('$host');
-
- $conn = ADONewConnection($driver);
-
- if ($debug) {
- $conn->debug = true;
- ADOConnection::outp( " driver=$driver user=$user db=$database ");
- }
-
- if ($persist) {
- switch($persist) {
- default:
- case 'P': $ok = $conn->PConnect($host, $user, $password, $database); break;
- case 'C': $ok = $conn->Connect($host, $user, $password, $database); break;
- case 'N': $ok = $conn->NConnect($host, $user, $password, $database); break;
- }
- } else {
- $ok = $conn->Connect($host, $user, $password, $database);
- }
-
- if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
- else
- ADOConnection::outp('Session: connection failed
', false);
-
-
- return $ok;
- }
-
- /*!
- Close the connection
- */
- static function close()
- {
-/*
- $conn = ADODB_Session::_conn();
- if ($conn) $conn->Close();
-*/
- return true;
- }
-
- /*
- Slurp in the session variables and return the serialized string
- */
- static function read($key)
- {
- $conn = ADODB_Session::_conn();
- $filter = ADODB_Session::filter();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return '';
- }
-
- //assert('$table');
-
- $qkey = $conn->quote($key);
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- $sql = "SELECT sessdata FROM $table WHERE sesskey = $binary $qkey AND expiry >= " . $conn->sysTimeStamp;
- /* Lock code does not work as it needs to hold transaction within whole page, and we don't know if
- developer has commited elsewhere... :(
- */
- #if (ADODB_Session::Lock())
- # $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), sessdata);
- #else
-
- $rs = $conn->Execute($sql);
- //ADODB_Session::_dumprs($rs);
- if ($rs) {
- if ($rs->EOF) {
- $v = '';
- } else {
- $v = reset($rs->fields);
- $filter = array_reverse($filter);
- foreach ($filter as $f) {
- if (is_object($f)) {
- $v = $f->read($v, ADODB_Session::_sessionKey());
- }
- }
- $v = rawurldecode($v);
- }
-
- $rs->Close();
-
- ADODB_Session::_crc(strlen($v) . crc32($v));
- return $v;
- }
-
- return '';
- }
-
- /*!
- Write the serialized data to a database.
-
- If the data has not been modified since the last read(), we do not write.
- */
- static function write($key, $oval)
- {
- global $ADODB_SESSION_READONLY;
-
- if (!empty($ADODB_SESSION_READONLY)) return;
-
- $clob = ADODB_Session::clob();
- $conn = ADODB_Session::_conn();
- $crc = ADODB_Session::_crc();
- $debug = ADODB_Session::debug();
- $driver = ADODB_Session::driver();
- $expire_notify = ADODB_Session::expireNotify();
- $filter = ADODB_Session::filter();
- $lifetime = ADODB_Session::lifetime();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return false;
- }
- if ($debug) $conn->debug = 1;
- $sysTimeStamp = $conn->sysTimeStamp;
-
- //assert('$table');
-
- $expiry = $conn->OffsetDate($lifetime/(24*3600),$sysTimeStamp);
-
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- // crc32 optimization since adodb 2.1
- // now we only update expiry date, thx to sebastian thom in adodb 2.32
- if ($crc !== false && $crc == (strlen($oval) . crc32($oval))) {
- if ($debug) {
- echo 'Session: Only updating date - crc32 not changed
';
- }
-
- $expirevar = '';
- if ($expire_notify) {
- $var = reset($expire_notify);
- global $$var;
- if (isset($$var)) {
- $expirevar = $$var;
- }
- }
-
-
- $sql = "UPDATE $table SET expiry = $expiry ,expireref=".$conn->Param('0').", modified = $sysTimeStamp WHERE $binary sesskey = ".$conn->Param('1')." AND expiry >= $sysTimeStamp";
- $rs = $conn->Execute($sql,array($expirevar,$key));
- return true;
- }
- $val = rawurlencode($oval);
- foreach ($filter as $f) {
- if (is_object($f)) {
- $val = $f->write($val, ADODB_Session::_sessionKey());
- }
- }
-
- $expireref = '';
- if ($expire_notify) {
- $var = reset($expire_notify);
- global $$var;
- if (isset($$var)) {
- $expireref = $$var;
- }
- }
-
- if (!$clob) { // no lobs, simply use replace()
- $rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
- if ($rs) $rs->Close();
-
- if ($rs && reset($rs->fields) > 0) {
- $sql = "UPDATE $table SET expiry=$expiry, sessdata=".$conn->Param(0).", expireref= ".$conn->Param(1).",modified=$sysTimeStamp WHERE sesskey = ".$conn->Param('2');
-
- } else {
- $sql = "INSERT INTO $table (expiry, sessdata, expireref, sesskey, created, modified)
- VALUES ($expiry,".$conn->Param('0').", ". $conn->Param('1').", ".$conn->Param('2').", $sysTimeStamp, $sysTimeStamp)";
- }
-
-
- $rs = $conn->Execute($sql,array($val,$expireref,$key));
-
- } else {
- // what value shall we insert/update for lob row?
- switch ($driver) {
- // empty_clob or empty_lob for oracle dbs
- case 'oracle':
- case 'oci8':
- case 'oci8po':
- case 'oci805':
- $lob_value = sprintf('empty_%s()', strtolower($clob));
- break;
-
- // null for all other
- default:
- $lob_value = 'null';
- break;
- }
-
- $conn->StartTrans();
-
- $rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
- if ($rs) $rs->Close();
-
- if ($rs && reset($rs->fields) > 0) {
- $sql = "UPDATE $table SET expiry=$expiry, sessdata=$lob_value, expireref= ".$conn->Param(0).",modified=$sysTimeStamp WHERE sesskey = ".$conn->Param('1');
-
- } else {
- $sql = "INSERT INTO $table (expiry, sessdata, expireref, sesskey, created, modified)
- VALUES ($expiry,$lob_value, ". $conn->Param('0').", ".$conn->Param('1').", $sysTimeStamp, $sysTimeStamp)";
- }
-
- $rs = $conn->Execute($sql,array($expireref,$key));
-
- $qkey = $conn->qstr($key);
- $rs2 = $conn->UpdateBlob($table, 'sessdata', $val, " sesskey=$qkey", strtoupper($clob));
- if ($debug) echo "
",htmlspecialchars($oval), "
";
- $rs = @$conn->CompleteTrans();
-
-
- }
-
- if (!$rs) {
- ADOConnection::outp('Session Replace: ' . $conn->ErrorMsg() . '
', false);
- return false;
- } else {
- // bug in access driver (could be odbc?) means that info is not committed
- // properly unless select statement executed in Win2000
- if ($conn->databaseType == 'access') {
- $sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- if ($rs) {
- $rs->Close();
- }
- }
- }/*
- if (ADODB_Session::Lock()) {
- $conn->CommitTrans();
- }*/
- return $rs ? true : false;
- }
-
- /*!
- */
- static function destroy($key) {
- $conn = ADODB_Session::_conn();
- $table = ADODB_Session::table();
- $expire_notify = ADODB_Session::expireNotify();
-
- if (!$conn) {
- return false;
- }
- $debug = ADODB_Session::debug();
- if ($debug) $conn->debug = 1;
- //assert('$table');
-
- $qkey = $conn->quote($key);
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- if ($expire_notify) {
- reset($expire_notify);
- $fn = next($expire_notify);
- $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
- $sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- $conn->SetFetchMode($savem);
- if (!$rs) {
- return false;
- }
- if (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- //assert('$ref');
- //assert('$key');
- $fn($ref, $key);
- }
- $rs->Close();
- }
-
- $sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- if ($rs) {
- $rs->Close();
- }
-
- return $rs ? true : false;
- }
-
- /*!
- */
- static function gc($maxlifetime)
- {
- $conn = ADODB_Session::_conn();
- $debug = ADODB_Session::debug();
- $expire_notify = ADODB_Session::expireNotify();
- $optimize = ADODB_Session::optimize();
- $table = ADODB_Session::table();
-
- if (!$conn) {
- return false;
- }
-
-
- $debug = ADODB_Session::debug();
- if ($debug) $conn->debug = 1;
-
- //assert('$table');
-
- $time = $conn->sysTimeStamp;
- $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
-
- if ($expire_notify) {
- reset($expire_notify);
- $fn = next($expire_notify);
- $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
- $sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- $conn->SetFetchMode($savem);
- if ($rs) {
- $conn->StartTrans();
- $keys = array();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref, $key);
- $del = $conn->Execute("DELETE FROM $table WHERE sesskey=".$conn->Param('0'),array($key));
- $rs->MoveNext();
- }
- $rs->Close();
-
- $conn->CompleteTrans();
- }
- } else {
-
- if (0) {
- $sql = "SELECT sesskey FROM $table WHERE expiry < $time";
- $arr = $conn->GetAll($sql);
- foreach ($arr as $row) {
- $sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
- $conn->Execute($sql2,array($row[0]));
- }
- } else {
- $sql = "DELETE FROM $table WHERE expiry < $time";
- $rs = $conn->Execute($sql);
- ADODB_Session::_dumprs($rs);
- if ($rs) $rs->Close();
- }
- if ($debug) {
- ADOConnection::outp("Garbage Collection: $sql
");
- }
- }
-
- // suggested by Cameron, "GaM3R"
- if ($optimize) {
- $driver = ADODB_Session::driver();
-
- if (preg_match('/mysql/i', $driver)) {
- $sql = "OPTIMIZE TABLE $table";
- }
- if (preg_match('/postgres/i', $driver)) {
- $sql = "VACUUM $table";
- }
- if (!empty($sql)) {
- $conn->Execute($sql);
- }
- }
-
-
- return true;
- }
-}
-
-ADODB_Session::_init();
-if (empty($ADODB_SESSION_READONLY))
- register_shutdown_function('session_write_close');
-
-// for backwards compatability only
-function adodb_sess_open($save_path, $session_name, $persist = true) {
- return ADODB_Session::open($save_path, $session_name, $persist);
-}
-
-// for backwards compatability only
-function adodb_sess_gc($t)
-{
- return ADODB_Session::gc($t);
-}
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/adodb-sessions.mysql.sql b/lib/adodb/session/adodb-sessions.mysql.sql
deleted file mode 100644
index f90de44931..0000000000
--- a/lib/adodb/session/adodb-sessions.mysql.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- $CVSHeader$
-
-CREATE DATABASE /*! IF NOT EXISTS */ adodb_sessions;
-
-USE adodb_sessions;
-
-DROP TABLE /*! IF EXISTS */ sessions;
-
-CREATE TABLE /*! IF NOT EXISTS */ sessions (
- sesskey CHAR(32) /*! BINARY */ NOT NULL DEFAULT '',
- expiry INT(11) /*! UNSIGNED */ NOT NULL DEFAULT 0,
- expireref VARCHAR(64) DEFAULT '',
- data LONGTEXT DEFAULT '',
- PRIMARY KEY (sesskey),
- INDEX expiry (expiry)
-);
diff --git a/lib/adodb/session/adodb-sessions.oracle.clob.sql b/lib/adodb/session/adodb-sessions.oracle.clob.sql
deleted file mode 100644
index c5c4f2d070..0000000000
--- a/lib/adodb/session/adodb-sessions.oracle.clob.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--- $CVSHeader$
-
-DROP TABLE adodb_sessions;
-
-CREATE TABLE sessions (
- sesskey CHAR(32) DEFAULT '' NOT NULL,
- expiry INT DEFAULT 0 NOT NULL,
- expireref VARCHAR(64) DEFAULT '',
- data CLOB DEFAULT '',
- PRIMARY KEY (sesskey)
-);
-
-CREATE INDEX ix_expiry ON sessions (expiry);
-
-QUIT;
diff --git a/lib/adodb/session/adodb-sessions.oracle.sql b/lib/adodb/session/adodb-sessions.oracle.sql
deleted file mode 100644
index 8fd5a34232..0000000000
--- a/lib/adodb/session/adodb-sessions.oracle.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- $CVSHeader$
-
-DROP TABLE adodb_sessions;
-
-CREATE TABLE sessions (
- sesskey CHAR(32) DEFAULT '' NOT NULL,
- expiry INT DEFAULT 0 NOT NULL,
- expireref VARCHAR(64) DEFAULT '',
- data VARCHAR(4000) DEFAULT '',
- PRIMARY KEY (sesskey),
- INDEX expiry (expiry)
-);
-
-CREATE INDEX ix_expiry ON sessions (expiry);
-
-QUIT;
diff --git a/lib/adodb/session/crypt.inc.php b/lib/adodb/session/crypt.inc.php
deleted file mode 100644
index 41cb06a5ad..0000000000
--- a/lib/adodb/session/crypt.inc.php
+++ /dev/null
@@ -1,161 +0,0 @@
-
-class MD5Crypt{
- function keyED($txt,$encrypt_key)
- {
- $encrypt_key = md5($encrypt_key);
- $ctr=0;
- $tmp = "";
- for ($i=0;$ikeyED($tmp,$key));
- }
-
- function Decrypt($txt,$key)
- {
- $txt = $this->keyED(base64_decode($txt),$key);
- $tmp = "";
- for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
- {
- $randnumber = rand(48,120);
- }
-
- $randomPassword .= chr($randnumber);
- }
- return $randomPassword;
- }
-
-}
-
-
-class SHA1Crypt{
-
- function keyED($txt,$encrypt_key)
- {
-
- $encrypt_key = sha1($encrypt_key);
- $ctr=0;
- $tmp = "";
-
- for ($i=0;$ikeyED($tmp,$key));
-
- }
-
-
-
- function Decrypt($txt,$key)
- {
-
- $txt = $this->keyED(base64_decode($txt),$key);
-
- $tmp = "";
-
- for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
- {
- $randnumber = rand(48,120);
- }
-
- $randomPassword .= chr($randnumber);
- }
-
- return $randomPassword;
-
- }
-
-
-
-}
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/old/adodb-cryptsession.php b/lib/adodb/session/old/adodb-cryptsession.php
deleted file mode 100644
index 8ae983f15d..0000000000
--- a/lib/adodb/session/old/adodb-cryptsession.php
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
- Set tabs to 4 for best viewing.
-
- Latest version of ADODB is available at http://php.weblogs.com/adodb
- ======================================================================
-
- This file provides PHP4 session management using the ADODB database
-wrapper library.
-
- Example
- =======
-
- include('adodb.inc.php');
- #---------------------------------#
- include('adodb-cryptsession.php');
- #---------------------------------#
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- print "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}
";
-
-
- Installation
- ============
- 1. Create a new database in MySQL or Access "sessions" like
-so:
-
- create table sessions (
- SESSKEY char(32) not null,
- EXPIRY int(11) unsigned not null,
- EXPIREREF varchar(64),
- DATA CLOB,
- primary key (sesskey)
- );
-
- 2. Then define the following parameters. You can either modify
- this file, or define them before this file is included:
-
- $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';
- $ADODB_SESSION_CONNECT='server to connect to';
- $ADODB_SESSION_USER ='user';
- $ADODB_SESSION_PWD ='password';
- $ADODB_SESSION_DB ='database';
- $ADODB_SESSION_TBL = 'sessions'
-
- 3. Recommended is PHP 4.0.2 or later. There are documented
-session bugs in earlier versions of PHP.
-
-*/
-
-
-include_once('crypt.inc.php');
-
-if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
-}
-
- /* if database time and system time is difference is greater than this, then give warning */
- define('ADODB_SESSION_SYNCH_SECS',60);
-
-if (!defined('ADODB_SESSION')) {
-
- define('ADODB_SESSION',1);
-
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_CONN,
- $ADODB_SESS_LIFE,
- $ADODB_SESS_DEBUG,
- $ADODB_SESS_INSERT,
- $ADODB_SESSION_EXPIRE_NOTIFY,
- $ADODB_SESSION_TBL;
-
- //$ADODB_SESS_DEBUG = true;
-
- /* SET THE FOLLOWING PARAMETERS */
-if (empty($ADODB_SESSION_DRIVER)) {
- $ADODB_SESSION_DRIVER='mysql';
- $ADODB_SESSION_CONNECT='localhost';
- $ADODB_SESSION_USER ='root';
- $ADODB_SESSION_PWD ='';
- $ADODB_SESSION_DB ='xphplens_2';
-}
-
-if (empty($ADODB_SESSION_TBL)){
- $ADODB_SESSION_TBL = 'sessions';
-}
-
-if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {
- $ADODB_SESSION_EXPIRE_NOTIFY = false;
-}
-
-function ADODB_Session_Key()
-{
-$ADODB_CRYPT_KEY = 'CRYPTED ADODB SESSIONS ROCK!';
-
- /* USE THIS FUNCTION TO CREATE THE ENCRYPTION KEY FOR CRYPTED SESSIONS */
- /* Crypt the used key, $ADODB_CRYPT_KEY as key and session_ID as SALT */
- return crypt($ADODB_CRYPT_KEY, session_ID());
-}
-
-$ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');
-if ($ADODB_SESS_LIFE <= 1) {
- // bug in PHP 4.0.3 pl 1 -- how about other versions?
- //print "Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE
";
- $ADODB_SESS_LIFE=1440;
-}
-
-function adodb_sess_open($save_path, $session_name)
-{
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_CONN,
- $ADODB_SESS_DEBUG;
-
- $ADODB_SESS_INSERT = false;
-
- if (isset($ADODB_SESS_CONN)) return true;
-
- $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);
- if (!empty($ADODB_SESS_DEBUG)) {
- $ADODB_SESS_CONN->debug = true;
- print" conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ";
- }
- return $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,
- $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
-
-}
-
-function adodb_sess_close()
-{
-global $ADODB_SESS_CONN;
-
- if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();
- return true;
-}
-
-function adodb_sess_read($key)
-{
-$Crypt = new MD5Crypt;
-global $ADODB_SESS_CONN,$ADODB_SESS_INSERT,$ADODB_SESSION_TBL;
- $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());
- if ($rs) {
- if ($rs->EOF) {
- $ADODB_SESS_INSERT = true;
- $v = '';
- } else {
- // Decrypt session data
- $v = rawurldecode($Crypt->Decrypt(reset($rs->fields), ADODB_Session_Key()));
- }
- $rs->Close();
- return $v;
- }
- else $ADODB_SESS_INSERT = true;
-
- return '';
-}
-
-function adodb_sess_write($key, $val)
-{
-$Crypt = new MD5Crypt;
- global $ADODB_SESS_INSERT,$ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- $expiry = time() + $ADODB_SESS_LIFE;
-
- // encrypt session data..
- $val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
-
- $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- global $$var;
- $arr['expireref'] = $$var;
- }
- $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,
- $arr,
- 'sesskey',$autoQuote = true);
-
- if (!$rs) {
- ADOConnection::outp( '
--- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'',false);
- } else {
- // bug in access driver (could be odbc?) means that info is not commited
- // properly unless select statement executed in Win2000
-
- if ($ADODB_SESS_CONN->databaseType == 'access') $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");
- }
- return isset($rs);
-}
-
-function adodb_sess_destroy($key)
-{
- global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $ADODB_SESS_CONN->CommitTrans();
- }
- } else {
- $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";
- $rs = $ADODB_SESS_CONN->Execute($qry);
- }
- return $rs ? true : false;
-}
-
-
-function adodb_sess_gc($maxlifetime) {
- global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY,$ADODB_SESS_DEBUG;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $t = time();
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < $t");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- //$del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $rs->Close();
-
- $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < $t");
- $ADODB_SESS_CONN->CommitTrans();
- }
- } else {
- $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();
- $ADODB_SESS_CONN->Execute($qry);
- }
-
- // suggested by Cameron, "GaM3R"
- if (defined('ADODB_SESSION_OPTIMIZE'))
- {
- global $ADODB_SESSION_DRIVER;
-
- switch( $ADODB_SESSION_DRIVER ) {
- case 'mysql':
- case 'mysqlt':
- $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;
- break;
- case 'postgresql':
- case 'postgresql7':
- $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;
- break;
- }
- }
-
- if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
- else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
-
- $rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
- if ($rs && !$rs->EOF) {
-
- $dbts = reset($rs->fields);
- $rs->Close();
- $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);
- $t = time();
- if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
- $msg =
- __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("
--- $msg");
- }
- }
-
- return true;
-}
-
-session_module_name('user');
-session_set_save_handler(
- "adodb_sess_open",
- "adodb_sess_close",
- "adodb_sess_read",
- "adodb_sess_write",
- "adodb_sess_destroy",
- "adodb_sess_gc");
-}
-
-/* TEST SCRIPT -- UNCOMMENT */
-/*
-if (0) {
-
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- print "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}";
-}
-*/
-?>
diff --git a/lib/adodb/session/old/adodb-session-clob.php b/lib/adodb/session/old/adodb-session-clob.php
deleted file mode 100644
index 84e5ae0e0e..0000000000
--- a/lib/adodb/session/old/adodb-session-clob.php
+++ /dev/null
@@ -1,448 +0,0 @@
-";
-
-To force non-persistent connections, call adodb_session_open first before session_start():
-
- include('adodb.inc.php');
- include('adodb-session.php');
- adodb_session_open(false,false,false);
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- print "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}";
-
-
- Installation
- ============
- 1. Create this table in your database (syntax might vary depending on your db):
-
- create table sessions (
- SESSKEY char(32) not null,
- EXPIRY int(11) unsigned not null,
- EXPIREREF varchar(64),
- DATA CLOB,
- primary key (sesskey)
- );
-
-
- 2. Then define the following parameters in this file:
- $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';
- $ADODB_SESSION_CONNECT='server to connect to';
- $ADODB_SESSION_USER ='user';
- $ADODB_SESSION_PWD ='password';
- $ADODB_SESSION_DB ='database';
- $ADODB_SESSION_TBL = 'sessions'
- $ADODB_SESSION_USE_LOBS = false; (or, if you wanna use CLOBS (= 'CLOB') or ( = 'BLOB')
-
- 3. Recommended is PHP 4.1.0 or later. There are documented
- session bugs in earlier versions of PHP.
-
- 4. If you want to receive notifications when a session expires, then
- you can tag a session with an EXPIREREF, and before the session
- record is deleted, we can call a function that will pass the EXPIREREF
- as the first parameter, and the session key as the second parameter.
-
- To do this, define a notification function, say NotifyFn:
-
- function NotifyFn($expireref, $sesskey)
- {
- }
-
- Then you need to define a global variable $ADODB_SESSION_EXPIRE_NOTIFY.
- This is an array with 2 elements, the first being the name of the variable
- you would like to store in the EXPIREREF field, and the 2nd is the
- notification function's name.
-
- In this example, we want to be notified when a user's session
- has expired, so we store the user id in the global variable $USERID,
- store this value in the EXPIREREF field:
-
- $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');
-
- Then when the NotifyFn is called, we are passed the $USERID as the first
- parameter, eg. NotifyFn($userid, $sesskey).
-*/
-
-if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
-}
-
-if (!defined('ADODB_SESSION')) {
-
- define('ADODB_SESSION',1);
-
- /* if database time and system time is difference is greater than this, then give warning */
- define('ADODB_SESSION_SYNCH_SECS',60);
-
-/****************************************************************************************\
- Global definitions
-\****************************************************************************************/
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_CONN,
- $ADODB_SESS_LIFE,
- $ADODB_SESS_DEBUG,
- $ADODB_SESSION_EXPIRE_NOTIFY,
- $ADODB_SESSION_CRC,
- $ADODB_SESSION_USE_LOBS,
- $ADODB_SESSION_TBL;
-
- if (!isset($ADODB_SESSION_USE_LOBS)) $ADODB_SESSION_USE_LOBS = 'CLOB';
-
- $ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');
- if ($ADODB_SESS_LIFE <= 1) {
- // bug in PHP 4.0.3 pl 1 -- how about other versions?
- //print "Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE
";
- $ADODB_SESS_LIFE=1440;
- }
- $ADODB_SESSION_CRC = false;
- //$ADODB_SESS_DEBUG = true;
-
- //////////////////////////////////
- /* SET THE FOLLOWING PARAMETERS */
- //////////////////////////////////
-
- if (empty($ADODB_SESSION_DRIVER)) {
- $ADODB_SESSION_DRIVER='mysql';
- $ADODB_SESSION_CONNECT='localhost';
- $ADODB_SESSION_USER ='root';
- $ADODB_SESSION_PWD ='';
- $ADODB_SESSION_DB ='xphplens_2';
- }
-
- if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {
- $ADODB_SESSION_EXPIRE_NOTIFY = false;
- }
- // Made table name configurable - by David Johnson djohnson@inpro.net
- if (empty($ADODB_SESSION_TBL)){
- $ADODB_SESSION_TBL = 'sessions';
- }
-
-
- // defaulting $ADODB_SESSION_USE_LOBS
- if (!isset($ADODB_SESSION_USE_LOBS) || empty($ADODB_SESSION_USE_LOBS)) {
- $ADODB_SESSION_USE_LOBS = false;
- }
-
- /*
- $ADODB_SESS['driver'] = $ADODB_SESSION_DRIVER;
- $ADODB_SESS['connect'] = $ADODB_SESSION_CONNECT;
- $ADODB_SESS['user'] = $ADODB_SESSION_USER;
- $ADODB_SESS['pwd'] = $ADODB_SESSION_PWD;
- $ADODB_SESS['db'] = $ADODB_SESSION_DB;
- $ADODB_SESS['life'] = $ADODB_SESS_LIFE;
- $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;
-
- $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;
- $ADODB_SESS['table'] = $ADODB_SESS_TBL;
- */
-
-/****************************************************************************************\
- Create the connection to the database.
-
- If $ADODB_SESS_CONN already exists, reuse that connection
-\****************************************************************************************/
-function adodb_sess_open($save_path, $session_name,$persist=true)
-{
-GLOBAL $ADODB_SESS_CONN;
- if (isset($ADODB_SESS_CONN)) return true;
-
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_DEBUG;
-
- // cannot use & below - do not know why...
- $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);
- if (!empty($ADODB_SESS_DEBUG)) {
- $ADODB_SESS_CONN->debug = true;
- ADOConnection::outp( " conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ");
- }
- if ($persist) $ok = $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,
- $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
- else $ok = $ADODB_SESS_CONN->Connect($ADODB_SESSION_CONNECT,
- $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
-
- if (!$ok) ADOConnection::outp( "
--- Session: connection failed",false);
-}
-
-/****************************************************************************************\
- Close the connection
-\****************************************************************************************/
-function adodb_sess_close()
-{
-global $ADODB_SESS_CONN;
-
- if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();
- return true;
-}
-
-/****************************************************************************************\
- Slurp in the session variables and return the serialized string
-\****************************************************************************************/
-function adodb_sess_read($key)
-{
-global $ADODB_SESS_CONN,$ADODB_SESSION_TBL,$ADODB_SESSION_CRC;
-
- $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());
- if ($rs) {
- if ($rs->EOF) {
- $v = '';
- } else
- $v = rawurldecode(reset($rs->fields));
-
- $rs->Close();
-
- // new optimization adodb 2.1
- $ADODB_SESSION_CRC = strlen($v).crc32($v);
-
- return $v;
- }
-
- return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com
-}
-
-/****************************************************************************************\
- Write the serialized data to a database.
-
- If the data has not been modified since adodb_sess_read(), we do not write.
-\****************************************************************************************/
-function adodb_sess_write($key, $val)
-{
- global
- $ADODB_SESS_CONN,
- $ADODB_SESS_LIFE,
- $ADODB_SESSION_TBL,
- $ADODB_SESS_DEBUG,
- $ADODB_SESSION_CRC,
- $ADODB_SESSION_EXPIRE_NOTIFY,
- $ADODB_SESSION_DRIVER, // added
- $ADODB_SESSION_USE_LOBS; // added
-
- $expiry = time() + $ADODB_SESS_LIFE;
-
- // crc32 optimization since adodb 2.1
- // 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 "
--- Session: Only updating date - crc32 not changed";
- $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();
- $rs = $ADODB_SESS_CONN->Execute($qry);
- return true;
- }
- $val = rawurlencode($val);
-
- $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- global $$var;
- $arr['expireref'] = $$var;
- }
-
-
- if ($ADODB_SESSION_USE_LOBS === false) { // no lobs, simply use replace()
- $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,$arr, 'sesskey',$autoQuote = true);
- if (!$rs) {
- $err = $ADODB_SESS_CONN->ErrorMsg();
- }
- } else {
- // what value shall we insert/update for lob row?
- switch ($ADODB_SESSION_DRIVER) {
- // empty_clob or empty_lob for oracle dbs
- case "oracle":
- case "oci8":
- case "oci8po":
- case "oci805":
- $lob_value = sprintf("empty_%s()", strtolower($ADODB_SESSION_USE_LOBS));
- break;
-
- // null for all other
- default:
- $lob_value = "null";
- break;
- }
-
- // do we insert or update? => as for sesskey
- $res = $ADODB_SESS_CONN->Execute("select count(*) as cnt from $ADODB_SESSION_TBL where sesskey = '$key'");
- if ($res && reset($res->fields) > 0) {
- $qry = sprintf("update %s set expiry = %d, data = %s where sesskey = '%s'", $ADODB_SESSION_TBL, $expiry, $lob_value, $key);
- } else {
- // insert
- $qry = sprintf("insert into %s (sesskey, expiry, data) values ('%s', %d, %s)", $ADODB_SESSION_TBL, $key, $expiry, $lob_value);
- }
-
- $err = "";
- $rs1 = $ADODB_SESS_CONN->Execute($qry);
- if (!$rs1) {
- $err .= $ADODB_SESS_CONN->ErrorMsg()."\n";
- }
- $rs2 = $ADODB_SESS_CONN->UpdateBlob($ADODB_SESSION_TBL, 'data', $val, "sesskey='$key'", strtoupper($ADODB_SESSION_USE_LOBS));
- if (!$rs2) {
- $err .= $ADODB_SESS_CONN->ErrorMsg()."\n";
- }
- $rs = ($rs1 && $rs2) ? true : false;
- }
-
- if (!$rs) {
- ADOConnection::outp( '
--- Session Replace: '.nl2br($err).'',false);
- } else {
- // bug in access driver (could be odbc?) means that info is not commited
- // properly unless select statement executed in Win2000
- if ($ADODB_SESS_CONN->databaseType == 'access')
- $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");
- }
- return !empty($rs);
-}
-
-function adodb_sess_destroy($key)
-{
- global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $ADODB_SESS_CONN->CommitTrans();
- }
- } else {
- $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";
- $rs = $ADODB_SESS_CONN->Execute($qry);
- }
- return $rs ? true : false;
-}
-
-function adodb_sess_gc($maxlifetime)
-{
- global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $t = time();
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < $t");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $rs->Close();
-
- //$ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < $t");
- $ADODB_SESS_CONN->CommitTrans();
-
- }
- } else {
- $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time());
-
- if ($ADODB_SESS_DEBUG) ADOConnection::outp("
--- Garbage Collection: $qry");
- }
- // suggested by Cameron, "GaM3R"
- if (defined('ADODB_SESSION_OPTIMIZE')) {
- global $ADODB_SESSION_DRIVER;
-
- switch( $ADODB_SESSION_DRIVER ) {
- case 'mysql':
- case 'mysqlt':
- $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;
- break;
- case 'postgresql':
- case 'postgresql7':
- $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;
- break;
- }
- if (!empty($opt_qry)) {
- $ADODB_SESS_CONN->Execute($opt_qry);
- }
- }
- if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
- else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
-
- $rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
- if ($rs && !$rs->EOF) {
-
- $dbts = reset($rs->fields);
- $rs->Close();
- $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);
- $t = time();
- if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
- $msg =
- __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("
--- $msg");
- }
- }
-
- return true;
-}
-
-session_module_name('user');
-session_set_save_handler(
- "adodb_sess_open",
- "adodb_sess_close",
- "adodb_sess_read",
- "adodb_sess_write",
- "adodb_sess_destroy",
- "adodb_sess_gc");
-}
-
-/* TEST SCRIPT -- UNCOMMENT */
-
-if (0) {
-
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- ADOConnection::outp( "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}",false);
-}
-
-?>
diff --git a/lib/adodb/session/old/adodb-session.php b/lib/adodb/session/old/adodb-session.php
deleted file mode 100644
index a3c141dd04..0000000000
--- a/lib/adodb/session/old/adodb-session.php
+++ /dev/null
@@ -1,439 +0,0 @@
-";
-
-To force non-persistent connections, call adodb_session_open first before session_start():
-
- include('adodb.inc.php');
- include('adodb-session.php');
- adodb_sess_open(false,false,false);
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- print "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}";
-
-
- Installation
- ============
- 1. Create this table in your database (syntax might vary depending on your db):
-
- create table sessions (
- SESSKEY char(32) not null,
- EXPIRY int(11) unsigned not null,
- EXPIREREF varchar(64),
- DATA text not null,
- primary key (sesskey)
- );
-
- For oracle:
- create table sessions (
- SESSKEY char(32) not null,
- EXPIRY DECIMAL(16) not null,
- EXPIREREF varchar(64),
- DATA varchar(4000) not null,
- primary key (sesskey)
- );
-
-
- 2. Then define the following parameters. You can either modify
- this file, or define them before this file is included:
-
- $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';
- $ADODB_SESSION_CONNECT='server to connect to';
- $ADODB_SESSION_USER ='user';
- $ADODB_SESSION_PWD ='password';
- $ADODB_SESSION_DB ='database';
- $ADODB_SESSION_TBL = 'sessions'
-
- 3. Recommended is PHP 4.1.0 or later. There are documented
- session bugs in earlier versions of PHP.
-
- 4. If you want to receive notifications when a session expires, then
- you can tag a session with an EXPIREREF, and before the session
- record is deleted, we can call a function that will pass the EXPIREREF
- as the first parameter, and the session key as the second parameter.
-
- To do this, define a notification function, say NotifyFn:
-
- function NotifyFn($expireref, $sesskey)
- {
- }
-
- Then you need to define a global variable $ADODB_SESSION_EXPIRE_NOTIFY.
- This is an array with 2 elements, the first being the name of the variable
- you would like to store in the EXPIREREF field, and the 2nd is the
- notification function's name.
-
- In this example, we want to be notified when a user's session
- has expired, so we store the user id in the global variable $USERID,
- store this value in the EXPIREREF field:
-
- $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');
-
- Then when the NotifyFn is called, we are passed the $USERID as the first
- parameter, eg. NotifyFn($userid, $sesskey).
-*/
-
-if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
-}
-
-if (!defined('ADODB_SESSION')) {
-
- define('ADODB_SESSION',1);
-
- /* 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;
-}
-
-/****************************************************************************************\
- Global definitions
-\****************************************************************************************/
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_CONN,
- $ADODB_SESS_LIFE,
- $ADODB_SESS_DEBUG,
- $ADODB_SESSION_EXPIRE_NOTIFY,
- $ADODB_SESSION_CRC,
- $ADODB_SESSION_TBL;
-
-
- $ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');
- if ($ADODB_SESS_LIFE <= 1) {
- // bug in PHP 4.0.3 pl 1 -- how about other versions?
- //print "Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE
";
- $ADODB_SESS_LIFE=1440;
- }
- $ADODB_SESSION_CRC = false;
- //$ADODB_SESS_DEBUG = true;
-
- //////////////////////////////////
- /* SET THE FOLLOWING PARAMETERS */
- //////////////////////////////////
-
- if (empty($ADODB_SESSION_DRIVER)) {
- $ADODB_SESSION_DRIVER='mysql';
- $ADODB_SESSION_CONNECT='localhost';
- $ADODB_SESSION_USER ='root';
- $ADODB_SESSION_PWD ='';
- $ADODB_SESSION_DB ='xphplens_2';
- }
-
- if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {
- $ADODB_SESSION_EXPIRE_NOTIFY = false;
- }
- // Made table name configurable - by David Johnson djohnson@inpro.net
- if (empty($ADODB_SESSION_TBL)){
- $ADODB_SESSION_TBL = 'sessions';
- }
-
- /*
- $ADODB_SESS['driver'] = $ADODB_SESSION_DRIVER;
- $ADODB_SESS['connect'] = $ADODB_SESSION_CONNECT;
- $ADODB_SESS['user'] = $ADODB_SESSION_USER;
- $ADODB_SESS['pwd'] = $ADODB_SESSION_PWD;
- $ADODB_SESS['db'] = $ADODB_SESSION_DB;
- $ADODB_SESS['life'] = $ADODB_SESS_LIFE;
- $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;
-
- $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;
- $ADODB_SESS['table'] = $ADODB_SESS_TBL;
- */
-
-/****************************************************************************************\
- Create the connection to the database.
-
- If $ADODB_SESS_CONN already exists, reuse that connection
-\****************************************************************************************/
-function adodb_sess_open($save_path, $session_name,$persist=true)
-{
-GLOBAL $ADODB_SESS_CONN;
- if (isset($ADODB_SESS_CONN)) return true;
-
-GLOBAL $ADODB_SESSION_CONNECT,
- $ADODB_SESSION_DRIVER,
- $ADODB_SESSION_USER,
- $ADODB_SESSION_PWD,
- $ADODB_SESSION_DB,
- $ADODB_SESS_DEBUG;
-
- // cannot use & below - do not know why...
- $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);
- if (!empty($ADODB_SESS_DEBUG)) {
- $ADODB_SESS_CONN->debug = true;
- ADOConnection::outp( " conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ");
- }
- if ($persist) $ok = $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,
- $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
- else $ok = $ADODB_SESS_CONN->Connect($ADODB_SESSION_CONNECT,
- $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
-
- if (!$ok) ADOConnection::outp( "
--- Session: connection failed",false);
-}
-
-/****************************************************************************************\
- Close the connection
-\****************************************************************************************/
-function adodb_sess_close()
-{
-global $ADODB_SESS_CONN;
-
- if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();
- return true;
-}
-
-/****************************************************************************************\
- Slurp in the session variables and return the serialized string
-\****************************************************************************************/
-function adodb_sess_read($key)
-{
-global $ADODB_SESS_CONN,$ADODB_SESSION_TBL,$ADODB_SESSION_CRC;
-
- $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());
- if ($rs) {
- if ($rs->EOF) {
- $v = '';
- } else
- $v = rawurldecode(reset($rs->fields));
-
- $rs->Close();
-
- // new optimization adodb 2.1
- $ADODB_SESSION_CRC = strlen($v).crc32($v);
-
- return $v;
- }
-
- return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com
-}
-
-/****************************************************************************************\
- Write the serialized data to a database.
-
- If the data has not been modified since adodb_sess_read(), we do not write.
-\****************************************************************************************/
-function adodb_sess_write($key, $val)
-{
- global
- $ADODB_SESS_CONN,
- $ADODB_SESS_LIFE,
- $ADODB_SESSION_TBL,
- $ADODB_SESS_DEBUG,
- $ADODB_SESSION_CRC,
- $ADODB_SESSION_EXPIRE_NOTIFY;
-
- $expiry = time() + $ADODB_SESS_LIFE;
-
- // crc32 optimization since adodb 2.1
- // 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 "
--- Session: Only updating date - crc32 not changed";
- $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();
- $rs = $ADODB_SESS_CONN->Execute($qry);
- return true;
- }
- $val = rawurlencode($val);
-
- $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- global $$var;
- $arr['expireref'] = $$var;
- }
- $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,$arr,
- 'sesskey',$autoQuote = true);
-
- if (!$rs) {
- ADOConnection::outp( '
--- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'',false);
- } else {
- // bug in access driver (could be odbc?) means that info is not commited
- // properly unless select statement executed in Win2000
- if ($ADODB_SESS_CONN->databaseType == 'access')
- $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");
- }
- return !empty($rs);
-}
-
-function adodb_sess_destroy($key)
-{
- global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $ADODB_SESS_CONN->CommitTrans();
- }
- } else {
- $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";
- $rs = $ADODB_SESS_CONN->Execute($qry);
- }
- return $rs ? true : false;
-}
-
-function adodb_sess_gc($maxlifetime)
-{
- global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
- if ($ADODB_SESSION_EXPIRE_NOTIFY) {
- reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
- $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
- $t = time();
- $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < $t");
- $ADODB_SESS_CONN->SetFetchMode($savem);
- if ($rs) {
- $ADODB_SESS_CONN->BeginTrans();
- while (!$rs->EOF) {
- $ref = $rs->fields[0];
- $key = $rs->fields[1];
- $fn($ref,$key);
- $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");
- $rs->MoveNext();
- }
- $rs->Close();
-
- $ADODB_SESS_CONN->CommitTrans();
-
- }
- } else {
- $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();
- $ADODB_SESS_CONN->Execute($qry);
-
- if ($ADODB_SESS_DEBUG) ADOConnection::outp("
--- Garbage Collection: $qry");
- }
- // suggested by Cameron, "GaM3R"
- if (defined('ADODB_SESSION_OPTIMIZE')) {
- global $ADODB_SESSION_DRIVER;
-
- switch( $ADODB_SESSION_DRIVER ) {
- case 'mysql':
- case 'mysqlt':
- $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;
- break;
- case 'postgresql':
- case 'postgresql7':
- $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;
- break;
- }
- if (!empty($opt_qry)) {
- $ADODB_SESS_CONN->Execute($opt_qry);
- }
- }
- if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
- else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
-
- $rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
- if ($rs && !$rs->EOF) {
-
- $dbts = reset($rs->fields);
- $rs->Close();
- $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);
- $t = time();
-
- if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {
-
- $msg =
- __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("
--- $msg");
- }
- }
-
- return true;
-}
-
-session_module_name('user');
-session_set_save_handler(
- "adodb_sess_open",
- "adodb_sess_close",
- "adodb_sess_read",
- "adodb_sess_write",
- "adodb_sess_destroy",
- "adodb_sess_gc");
-}
-
-/* TEST SCRIPT -- UNCOMMENT */
-
-if (0) {
-
- session_start();
- session_register('AVAR');
- $_SESSION['AVAR'] += 1;
- ADOConnection::outp( "
--- \$_SESSION['AVAR']={$_SESSION['AVAR']}",false);
-}
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/old/crypt.inc.php b/lib/adodb/session/old/crypt.inc.php
deleted file mode 100644
index b99bbba551..0000000000
--- a/lib/adodb/session/old/crypt.inc.php
+++ /dev/null
@@ -1,64 +0,0 @@
-
-class MD5Crypt{
- function keyED($txt,$encrypt_key)
- {
- $encrypt_key = md5($encrypt_key);
- $ctr=0;
- $tmp = "";
- for ($i=0;$ikeyED($tmp,$key));
- }
-
- function Decrypt($txt,$key)
- {
- $txt = $this->keyED(base64_decode($txt),$key);
- $tmp = "";
- for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
- {
- $randnumber = rand(48,120);
- }
-
- $randomPassword .= chr($randnumber);
- }
- return $randomPassword;
- }
-
-}
-?>
\ No newline at end of file
diff --git a/lib/adodb/session/session_schema.xml b/lib/adodb/session/session_schema.xml
deleted file mode 100644
index 3c61ff645a..0000000000
--- a/lib/adodb/session/session_schema.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- table for ADOdb session-management
-
-
- session key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/adodb/session/session_schema2.xml b/lib/adodb/session/session_schema2.xml
deleted file mode 100644
index 22f8dafedd..0000000000
--- a/lib/adodb/session/session_schema2.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- table for ADOdb session-management
-
-
- session key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/db/install.xml b/lib/db/install.xml
index b456ca53c7..ca443a3b09 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -1,5 +1,5 @@
-
@@ -440,12 +440,13 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index 8dff907cd3..89d2e1f3d5 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -1240,61 +1240,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint($result, 2009010604);
}
- if ($result && $oldversion < 2009010605) {
-
- /// Define table sessions to be dropped
- $table = new xmldb_table('sessions2');
-
- /// Conditionally launch drop table for sessions
- if ($dbman->table_exists($table)) {
- $dbman->drop_table($table);
- }
-
- /// Define table sessions to be dropped
- $table = new xmldb_table('sessions');
-
- /// Conditionally launch drop table for sessions
- if ($dbman->table_exists($table)) {
- $dbman->drop_table($table);
- }
-
- /// Main savepoint reached
- upgrade_main_savepoint($result, 2009010605);
- }
-
- if ($result && $oldversion < 2009010606) {
-
- /// Define table sessions to be created
- $table = new xmldb_table('sessions');
-
- /// Adding fields to table sessions
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
- $table->add_field('state', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
- $table->add_field('sid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, null, null);
- $table->add_field('sessdata', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
- $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
- $table->add_field('firstip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null);
- $table->add_field('lastip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null);
-
- /// Adding keys to table sessions
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
- $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
-
- /// Adding indexes to table sessions
- $table->add_index('state', XMLDB_INDEX_NOTUNIQUE, array('state'));
- $table->add_index('sid', XMLDB_INDEX_UNIQUE, array('sid'));
- $table->add_index('timecreated', XMLDB_INDEX_NOTUNIQUE, array('timecreated'));
- $table->add_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
-
- /// Launch create table for sessions
- $dbman->create_table($table);
-
- /// Main savepoint reached
- upgrade_main_savepoint($result, 2009010606);
- }
-
if ($result && $oldversion < 2009010800) {
/// Update the notifyloginfailures setting.
if ($CFG->notifyloginfailures == 'mainadmin') {
@@ -1378,6 +1323,56 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint($result, 2009011303);
}
+ if ($result && $oldversion < 2009011400) {
+
+ /// Define table sessions2 to be dropped
+ $table = new xmldb_table('sessions2');
+
+ /// Conditionally launch drop table for sessions
+ if ($dbman->table_exists($table)) {
+ $dbman->drop_table($table);
+ }
+
+ /// Define table sessions to be dropped
+ $table = new xmldb_table('sessions');
+
+ /// Conditionally launch drop table for sessions
+ if ($dbman->table_exists($table)) {
+ $dbman->drop_table($table);
+ }
+
+ /// Define table sessions to be created
+ $table = new xmldb_table('sessions');
+
+ /// Adding fields to table sessions
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $table->add_field('state', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
+ $table->add_field('sid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, null, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
+ $table->add_field('sessdata', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null);
+ $table->add_field('sessdatahash', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
+ $table->add_field('firstip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null);
+ $table->add_field('lastip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null);
+
+ /// Adding keys to table sessions
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+
+ /// Adding indexes to table sessions
+ $table->add_index('state', XMLDB_INDEX_NOTUNIQUE, array('state'));
+ $table->add_index('sid', XMLDB_INDEX_UNIQUE, array('sid'));
+ $table->add_index('timecreated', XMLDB_INDEX_NOTUNIQUE, array('timecreated'));
+ $table->add_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
+
+ /// Launch create table for sessions
+ $dbman->create_table($table);
+
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2009011400);
+ }
+
return $result;
}
diff --git a/lib/simpletestlib.php b/lib/simpletestlib.php
index 2d20163edf..5532655857 100644
--- a/lib/simpletestlib.php
+++ b/lib/simpletestlib.php
@@ -216,7 +216,7 @@ class FakeDBUnitTestCase extends UnitTestCase {
$tables = $DB->get_tables();
foreach ($tables as $table) {
- if ($table != 'sessions2' && isset($tabledata[$table])) {
+ if ($table != 'sessions' && isset($tabledata[$table])) {
// $DB->delete_records_select($table, "id > ?", array($tabledata[$table]));
}
}
diff --git a/version.php b/version.php
index db04f260ba..802ab60205 100644
--- a/version.php
+++ b/version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2009011303; // YYYYMMDD = date of the last version bump
+ $version = 2009011400; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20090114)'; // Human-friendly version name
--
2.39.5