mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merged from McMasterReports branch
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
@@ -21,14 +21,14 @@ class ADODB_Encrypt_MD5 {
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
$md5crypt =& new MD5Crypt();
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->encrypt($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
$md5crypt =& new MD5Crypt();
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->decrypt($data, $key);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<?php
|
||||
if (!defined('ADODB_SESSION')) die();
|
||||
|
||||
include_once ADODB_SESSION . '/crypt.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
|
||||
class ADODB_Encrypt_SHA1 {
|
||||
|
||||
function write($data, $key)
|
||||
{
|
||||
$sha1crypt =& new SHA1Crypt();
|
||||
return $sha1crypt->encrypt($data, $key);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function read($data, $key)
|
||||
{
|
||||
$sha1crypt =& new SHA1Crypt();
|
||||
return $sha1crypt->decrypt($data, $key);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
<?php
|
||||
if (!defined('ADODB_SESSION')) die();
|
||||
|
||||
include_once ADODB_SESSION . '/crypt.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
|
||||
class ADODB_Encrypt_SHA1 {
|
||||
|
||||
function write($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->encrypt($data, $key);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function read($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->decrypt($data, $key);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
@@ -59,7 +59,7 @@ function adodb_unserialize( $serialized_string )
|
||||
*/
|
||||
function adodb_session_regenerate_id()
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
if (!$conn) return false;
|
||||
|
||||
$old_id = session_id();
|
||||
@@ -72,7 +72,7 @@ function adodb_session_regenerate_id()
|
||||
//@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));
|
||||
$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) {
|
||||
@@ -95,7 +95,7 @@ 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===null) $conn = ADODB_Session::_conn();
|
||||
|
||||
if (!$conn) return 0;
|
||||
|
||||
@@ -421,7 +421,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function &_conn($conn=null) {
|
||||
function _conn($conn=null) {
|
||||
return $GLOBALS['ADODB_SESS_CONN'];
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ class ADODB_Session {
|
||||
/*!
|
||||
*/
|
||||
function _dumprs($rs) {
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$debug = ADODB_Session::debug();
|
||||
|
||||
if (!$conn) {
|
||||
@@ -515,7 +515,7 @@ class ADODB_Session {
|
||||
*/
|
||||
function open($save_path, $session_name, $persist = null)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
|
||||
if ($conn) {
|
||||
return true;
|
||||
@@ -539,7 +539,7 @@ class ADODB_Session {
|
||||
# assert('$driver');
|
||||
# assert('$host');
|
||||
|
||||
$conn =& ADONewConnection($driver);
|
||||
$conn = ADONewConnection($driver);
|
||||
|
||||
if ($debug) {
|
||||
$conn->debug = true;
|
||||
@@ -557,7 +557,7 @@ class ADODB_Session {
|
||||
$ok = $conn->Connect($host, $user, $password, $database);
|
||||
}
|
||||
|
||||
if ($ok) $GLOBALS['ADODB_SESS_CONN'] =& $conn;
|
||||
if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
|
||||
else
|
||||
ADOConnection::outp('<p>Session: connection failed</p>', false);
|
||||
|
||||
@@ -571,7 +571,7 @@ class ADODB_Session {
|
||||
function close()
|
||||
{
|
||||
/*
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
if ($conn) $conn->Close();
|
||||
*/
|
||||
return true;
|
||||
@@ -582,7 +582,7 @@ class ADODB_Session {
|
||||
*/
|
||||
function read($key)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$data = ADODB_Session::dataFieldName();
|
||||
$filter = ADODB_Session::filter();
|
||||
$table = ADODB_Session::table();
|
||||
@@ -601,10 +601,10 @@ class ADODB_Session {
|
||||
developer has commited elsewhere... :(
|
||||
*/
|
||||
#if (ADODB_Session::Lock())
|
||||
# $rs =& $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), $data);
|
||||
# $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), $data);
|
||||
#else
|
||||
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
//ADODB_Session::_dumprs($rs);
|
||||
if ($rs) {
|
||||
if ($rs->EOF) {
|
||||
@@ -641,7 +641,7 @@ class ADODB_Session {
|
||||
if (!empty($ADODB_SESSION_READONLY)) return;
|
||||
|
||||
$clob = ADODB_Session::clob();
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$crc = ADODB_Session::_crc();
|
||||
$data = ADODB_Session::dataFieldName();
|
||||
$debug = ADODB_Session::debug();
|
||||
@@ -666,7 +666,7 @@ class ADODB_Session {
|
||||
// now we only update expiry date, thx to sebastian thom in adodb 2.32
|
||||
if ($crc !== false && $crc == (strlen($val) . crc32($val))) {
|
||||
if ($debug) {
|
||||
echo '<p>Session: Only updating date - crc32 not changed</p>';
|
||||
ADOConnection::outp( '<p>Session: Only updating date - crc32 not changed</p>');
|
||||
}
|
||||
|
||||
$expirevar = '';
|
||||
@@ -680,7 +680,7 @@ class ADODB_Session {
|
||||
|
||||
|
||||
$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()));
|
||||
$rs = $conn->Execute($sql,array($expiry,$expirevar,$key,time()));
|
||||
return true;
|
||||
}
|
||||
$val = rawurlencode($val);
|
||||
@@ -700,7 +700,7 @@ class ADODB_Session {
|
||||
}
|
||||
|
||||
if (!$clob) { // no lobs, simply use replace()
|
||||
$arr[$data] = $conn->qstr($val);
|
||||
$arr[$data] = $val;
|
||||
$rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
|
||||
|
||||
} else {
|
||||
@@ -723,7 +723,7 @@ class ADODB_Session {
|
||||
$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");
|
||||
$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 {
|
||||
@@ -733,10 +733,10 @@ class ADODB_Session {
|
||||
|
||||
|
||||
$err = '';
|
||||
$rs1 =& $conn->Execute($sql);
|
||||
$rs1 = $conn->Execute($sql);
|
||||
if (!$rs1) $err = $conn->ErrorMsg()."\n";
|
||||
|
||||
$rs2 =& $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
|
||||
$rs2 = $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
|
||||
if (!$rs2) $err .= $conn->ErrorMsg()."\n";
|
||||
|
||||
$rs = ($rs && $rs2) ? true : false;
|
||||
@@ -751,7 +751,7 @@ class ADODB_Session {
|
||||
// properly unless select statement executed in Win2000
|
||||
if ($conn->databaseType == 'access') {
|
||||
$sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
if ($rs) {
|
||||
$rs->Close();
|
||||
@@ -767,7 +767,7 @@ class ADODB_Session {
|
||||
/*!
|
||||
*/
|
||||
function destroy($key) {
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$table = ADODB_Session::table();
|
||||
$expire_notify = ADODB_Session::expireNotify();
|
||||
|
||||
@@ -785,7 +785,7 @@ class ADODB_Session {
|
||||
$fn = next($expire_notify);
|
||||
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
|
||||
$sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
$conn->SetFetchMode($savem);
|
||||
if (!$rs) {
|
||||
@@ -802,7 +802,7 @@ class ADODB_Session {
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
|
||||
return $rs ? true : false;
|
||||
@@ -812,7 +812,7 @@ class ADODB_Session {
|
||||
*/
|
||||
function gc($maxlifetime)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$debug = ADODB_Session::debug();
|
||||
$expire_notify = ADODB_Session::expireNotify();
|
||||
$optimize = ADODB_Session::optimize();
|
||||
@@ -832,7 +832,7 @@ class ADODB_Session {
|
||||
$fn = next($expire_notify);
|
||||
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
|
||||
$sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
$conn->SetFetchMode($savem);
|
||||
if ($rs) {
|
||||
@@ -853,14 +853,14 @@ class ADODB_Session {
|
||||
|
||||
if (1) {
|
||||
$sql = "SELECT sesskey FROM $table WHERE expiry < $time";
|
||||
$arr =& $conn->GetAll($sql);
|
||||
$arr = $conn->GetAll($sql);
|
||||
foreach ($arr as $row) {
|
||||
$sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
|
||||
$conn->Execute($sql2,array($row[0]));
|
||||
$conn->Execute($sql2,array(reset($row)));
|
||||
}
|
||||
} else {
|
||||
$sql = "DELETE FROM $table WHERE expiry < $time";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
if ($rs) $rs->Close();
|
||||
}
|
||||
@@ -893,7 +893,7 @@ class ADODB_Session {
|
||||
}
|
||||
$sql .= " FROM $table";
|
||||
|
||||
$rs =& $conn->SelectLimit($sql, 1);
|
||||
$rs = $conn->SelectLimit($sql, 1);
|
||||
if ($rs && !$rs->EOF) {
|
||||
$dbts = reset($rs->fields);
|
||||
$rs->Close();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Contributed by Ross Smith (adodb@netebb.com).
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
@@ -89,7 +89,7 @@ function adodb_unserialize( $serialized_string )
|
||||
*/
|
||||
function adodb_session_regenerate_id()
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
if (!$conn) return false;
|
||||
|
||||
$old_id = session_id();
|
||||
@@ -102,7 +102,7 @@ function adodb_session_regenerate_id()
|
||||
//@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));
|
||||
$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) {
|
||||
@@ -125,7 +125,7 @@ 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===null) $conn = ADODB_Session::_conn();
|
||||
|
||||
if (!$conn) return 0;
|
||||
|
||||
@@ -154,7 +154,7 @@ class ADODB_Session {
|
||||
*/
|
||||
/*!
|
||||
*/
|
||||
function driver($driver = null)
|
||||
static function driver($driver = null)
|
||||
{
|
||||
static $_driver = 'mysql';
|
||||
static $set = false;
|
||||
@@ -174,7 +174,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function host($host = null) {
|
||||
static function host($host = null) {
|
||||
static $_host = 'localhost';
|
||||
static $set = false;
|
||||
|
||||
@@ -193,7 +193,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function user($user = null)
|
||||
static function user($user = null)
|
||||
{
|
||||
static $_user = 'root';
|
||||
static $set = false;
|
||||
@@ -213,7 +213,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function password($password = null)
|
||||
static function password($password = null)
|
||||
{
|
||||
static $_password = '';
|
||||
static $set = false;
|
||||
@@ -233,7 +233,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function database($database = null)
|
||||
static function database($database = null)
|
||||
{
|
||||
static $_database = '';
|
||||
static $set = false;
|
||||
@@ -252,7 +252,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function persist($persist = null)
|
||||
static function persist($persist = null)
|
||||
{
|
||||
static $_persist = true;
|
||||
|
||||
@@ -265,7 +265,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function lifetime($lifetime = null)
|
||||
static function lifetime($lifetime = null)
|
||||
{
|
||||
static $_lifetime;
|
||||
static $set = false;
|
||||
@@ -293,7 +293,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function debug($debug = null)
|
||||
static function debug($debug = null)
|
||||
{
|
||||
static $_debug = false;
|
||||
static $set = false;
|
||||
@@ -303,7 +303,7 @@ class ADODB_Session {
|
||||
|
||||
$conn = ADODB_Session::_conn();
|
||||
if ($conn) {
|
||||
$conn->debug = $_debug;
|
||||
#$conn->debug = $_debug;
|
||||
}
|
||||
$set = true;
|
||||
} elseif (!$set) {
|
||||
@@ -318,7 +318,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function expireNotify($expire_notify = null)
|
||||
static function expireNotify($expire_notify = null)
|
||||
{
|
||||
static $_expire_notify;
|
||||
static $set = false;
|
||||
@@ -338,7 +338,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function table($table = null)
|
||||
static function table($table = null)
|
||||
{
|
||||
static $_table = 'sessions2';
|
||||
static $set = false;
|
||||
@@ -358,7 +358,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function optimize($optimize = null)
|
||||
static function optimize($optimize = null)
|
||||
{
|
||||
static $_optimize = false;
|
||||
static $set = false;
|
||||
@@ -378,7 +378,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function syncSeconds($sync_seconds = null) {
|
||||
static function syncSeconds($sync_seconds = null) {
|
||||
//echo ("<p>WARNING: ADODB_SESSION::syncSeconds is longer used, please remove this function for your code</p>");
|
||||
|
||||
return 0;
|
||||
@@ -386,7 +386,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function clob($clob = null) {
|
||||
static function clob($clob = null) {
|
||||
static $_clob = false;
|
||||
static $set = false;
|
||||
|
||||
@@ -405,14 +405,14 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function dataFieldName($data_field_name = null) {
|
||||
static function dataFieldName($data_field_name = null) {
|
||||
//echo ("<p>WARNING: ADODB_SESSION::dataFieldName() is longer used, please remove this function for your code</p>");
|
||||
return '';
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
function filter($filter = null) {
|
||||
static function filter($filter = null) {
|
||||
static $_filter = array();
|
||||
|
||||
if (!is_null($filter)) {
|
||||
@@ -427,7 +427,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function encryptionKey($encryption_key = null) {
|
||||
static function encryptionKey($encryption_key = null) {
|
||||
static $_encryption_key = 'CRYPTED ADODB SESSIONS ROCK!';
|
||||
|
||||
if (!is_null($encryption_key)) {
|
||||
@@ -443,19 +443,13 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function &_conn($conn=null)
|
||||
{
|
||||
if (isset($GLOBALS['ADODB_SESS_CONN'])) {
|
||||
$conn =& $GLOBALS['ADODB_SESS_CONN'];
|
||||
return $conn;
|
||||
}
|
||||
$false = false;
|
||||
return $false;
|
||||
static function _conn($conn=null) {
|
||||
return isset($GLOBALS['ADODB_SESS_CONN']) ? $GLOBALS['ADODB_SESS_CONN'] : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
function _crc($crc = null) {
|
||||
static function _crc($crc = null) {
|
||||
static $_crc = false;
|
||||
|
||||
if (!is_null($crc)) {
|
||||
@@ -467,7 +461,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function _init() {
|
||||
static function _init() {
|
||||
session_module_name('user');
|
||||
session_set_save_handler(
|
||||
array('ADODB_Session', 'open'),
|
||||
@@ -482,7 +476,7 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function _sessionKey() {
|
||||
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());
|
||||
@@ -490,8 +484,8 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function _dumprs($rs) {
|
||||
$conn =& ADODB_Session::_conn();
|
||||
static function _dumprs($rs) {
|
||||
$conn = ADODB_Session::_conn();
|
||||
$debug = ADODB_Session::debug();
|
||||
|
||||
if (!$conn) {
|
||||
@@ -521,7 +515,7 @@ class ADODB_Session {
|
||||
// public methods
|
||||
/////////////////////
|
||||
|
||||
function config($driver, $host, $user, $password, $database=false,$options=false)
|
||||
static function config($driver, $host, $user, $password, $database=false,$options=false)
|
||||
{
|
||||
ADODB_Session::driver($driver);
|
||||
ADODB_Session::host($host);
|
||||
@@ -541,9 +535,9 @@ class ADODB_Session {
|
||||
|
||||
If $conn already exists, reuse that connection
|
||||
*/
|
||||
function open($save_path, $session_name, $persist = null)
|
||||
static function open($save_path, $session_name, $persist = null)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
|
||||
if ($conn) {
|
||||
return true;
|
||||
@@ -567,7 +561,7 @@ class ADODB_Session {
|
||||
# assert('$driver');
|
||||
# assert('$host');
|
||||
|
||||
$conn =& ADONewConnection($driver);
|
||||
$conn = ADONewConnection($driver);
|
||||
|
||||
if ($debug) {
|
||||
$conn->debug = true;
|
||||
@@ -585,7 +579,7 @@ class ADODB_Session {
|
||||
$ok = $conn->Connect($host, $user, $password, $database);
|
||||
}
|
||||
|
||||
if ($ok) $GLOBALS['ADODB_SESS_CONN'] =& $conn;
|
||||
if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
|
||||
else
|
||||
ADOConnection::outp('<p>Session: connection failed</p>', false);
|
||||
|
||||
@@ -596,10 +590,10 @@ class ADODB_Session {
|
||||
/*!
|
||||
Close the connection
|
||||
*/
|
||||
function close()
|
||||
static function close()
|
||||
{
|
||||
/*
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
if ($conn) $conn->Close();
|
||||
*/
|
||||
return true;
|
||||
@@ -608,9 +602,9 @@ class ADODB_Session {
|
||||
/*
|
||||
Slurp in the session variables and return the serialized string
|
||||
*/
|
||||
function read($key)
|
||||
static function read($key)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$filter = ADODB_Session::filter();
|
||||
$table = ADODB_Session::table();
|
||||
|
||||
@@ -620,18 +614,16 @@ class ADODB_Session {
|
||||
|
||||
//assert('$table');
|
||||
|
||||
$qkey = $conn->quote($key);
|
||||
$binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
|
||||
|
||||
$sql = "SELECT sessdata FROM $table WHERE sesskey = $binary $qkey AND expiry >= " . $conn->sysTimeStamp;
|
||||
$sql = "SELECT sessdata FROM $table WHERE sesskey = $binary ".$conn->Param(0)." 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);
|
||||
# $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), sessdata);
|
||||
#else
|
||||
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql, array($key));
|
||||
//ADODB_Session::_dumprs($rs);
|
||||
if ($rs) {
|
||||
if ($rs->EOF) {
|
||||
@@ -661,14 +653,14 @@ class ADODB_Session {
|
||||
|
||||
If the data has not been modified since the last read(), we do not write.
|
||||
*/
|
||||
function write($key, $val)
|
||||
static function write($key, $oval)
|
||||
{
|
||||
global $ADODB_SESSION_READONLY;
|
||||
|
||||
if (!empty($ADODB_SESSION_READONLY)) return;
|
||||
|
||||
$clob = ADODB_Session::clob();
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$crc = ADODB_Session::_crc();
|
||||
$debug = ADODB_Session::debug();
|
||||
$driver = ADODB_Session::driver();
|
||||
@@ -680,7 +672,7 @@ class ADODB_Session {
|
||||
if (!$conn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($debug) $conn->debug = 1;
|
||||
$sysTimeStamp = $conn->sysTimeStamp;
|
||||
|
||||
//assert('$table');
|
||||
@@ -691,7 +683,7 @@ class ADODB_Session {
|
||||
|
||||
// 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 ($crc !== false && $crc == (strlen($oval) . crc32($oval))) {
|
||||
if ($debug) {
|
||||
echo '<p>Session: Only updating date - crc32 not changed</p>';
|
||||
}
|
||||
@@ -707,10 +699,10 @@ class ADODB_Session {
|
||||
|
||||
|
||||
$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));
|
||||
$rs = $conn->Execute($sql,array($expirevar,$key));
|
||||
return true;
|
||||
}
|
||||
$val = rawurlencode($val);
|
||||
$val = rawurlencode($oval);
|
||||
foreach ($filter as $f) {
|
||||
if (is_object($f)) {
|
||||
$val = $f->write($val, ADODB_Session::_sessionKey());
|
||||
@@ -727,7 +719,7 @@ class ADODB_Session {
|
||||
}
|
||||
|
||||
if (!$clob) { // no lobs, simply use replace()
|
||||
$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
|
||||
$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) {
|
||||
@@ -739,7 +731,7 @@ class ADODB_Session {
|
||||
}
|
||||
|
||||
|
||||
$rs =& $conn->Execute($sql,array($val,$expireref,$key));
|
||||
$rs = $conn->Execute($sql,array($val,$expireref,$key));
|
||||
|
||||
} else {
|
||||
// what value shall we insert/update for lob row?
|
||||
@@ -760,7 +752,7 @@ class ADODB_Session {
|
||||
|
||||
$conn->StartTrans();
|
||||
|
||||
$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
|
||||
$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) {
|
||||
@@ -771,10 +763,11 @@ class ADODB_Session {
|
||||
VALUES ($expiry,$lob_value, ". $conn->Param('0').", ".$conn->Param('1').", $sysTimeStamp, $sysTimeStamp)";
|
||||
}
|
||||
|
||||
$rs =& $conn->Execute($sql,array($expireref,$key));
|
||||
$rs = $conn->Execute($sql,array($expireref,$key));
|
||||
|
||||
$qkey = $conn->qstr($key);
|
||||
$rs2 = $conn->UpdateBlob($table, 'sessdata', $val, " sesskey=$qkey", strtoupper($clob));
|
||||
if ($debug) echo "<hr>",htmlspecialchars($oval), "<hr>";
|
||||
$rs = @$conn->CompleteTrans();
|
||||
|
||||
|
||||
@@ -788,7 +781,7 @@ class ADODB_Session {
|
||||
// properly unless select statement executed in Win2000
|
||||
if ($conn->databaseType == 'access') {
|
||||
$sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
if ($rs) {
|
||||
$rs->Close();
|
||||
@@ -803,15 +796,16 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function destroy($key) {
|
||||
$conn =& ADODB_Session::_conn();
|
||||
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);
|
||||
@@ -822,7 +816,7 @@ class ADODB_Session {
|
||||
$fn = next($expire_notify);
|
||||
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
|
||||
$sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
$conn->SetFetchMode($savem);
|
||||
if (!$rs) {
|
||||
@@ -839,7 +833,7 @@ class ADODB_Session {
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
if ($rs) {
|
||||
$rs->Close();
|
||||
@@ -850,9 +844,9 @@ class ADODB_Session {
|
||||
|
||||
/*!
|
||||
*/
|
||||
function gc($maxlifetime)
|
||||
static function gc($maxlifetime)
|
||||
{
|
||||
$conn =& ADODB_Session::_conn();
|
||||
$conn = ADODB_Session::_conn();
|
||||
$debug = ADODB_Session::debug();
|
||||
$expire_notify = ADODB_Session::expireNotify();
|
||||
$optimize = ADODB_Session::optimize();
|
||||
@@ -862,6 +856,10 @@ class ADODB_Session {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$debug = ADODB_Session::debug();
|
||||
if ($debug) $conn->debug = 1;
|
||||
|
||||
//assert('$table');
|
||||
|
||||
$time = $conn->sysTimeStamp;
|
||||
@@ -872,7 +870,7 @@ class ADODB_Session {
|
||||
$fn = next($expire_notify);
|
||||
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
|
||||
$sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
$conn->SetFetchMode($savem);
|
||||
if ($rs) {
|
||||
@@ -893,14 +891,14 @@ class ADODB_Session {
|
||||
|
||||
if (0) {
|
||||
$sql = "SELECT sesskey FROM $table WHERE expiry < $time";
|
||||
$arr =& $conn->GetAll($sql);
|
||||
$arr = $conn->GetAll($sql);
|
||||
foreach ($arr as $row) {
|
||||
$sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
|
||||
$conn->Execute($sql2,array($row[0]));
|
||||
$conn->Execute($sql2,array(reset($row)));
|
||||
}
|
||||
} else {
|
||||
$sql = "DELETE FROM $table WHERE expiry < $time";
|
||||
$rs =& $conn->Execute($sql);
|
||||
$rs = $conn->Execute($sql);
|
||||
ADODB_Session::_dumprs($rs);
|
||||
if ($rs) $rs->Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user