mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merging the Limesurvey 1.91+ branch of queXS in to the trunk
This commit is contained in:
@@ -1,115 +1,115 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
if (!function_exists('bzcompress')) {
|
||||
trigger_error('bzip2 functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
trigger_error('bzip2 functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
*/
|
||||
class ADODB_Compress_Bzip2 {
|
||||
/**
|
||||
*/
|
||||
var $_block_size = null;
|
||||
/**
|
||||
*/
|
||||
var $_block_size = null;
|
||||
|
||||
/**
|
||||
*/
|
||||
var $_work_level = null;
|
||||
/**
|
||||
*/
|
||||
var $_work_level = null;
|
||||
|
||||
/**
|
||||
*/
|
||||
var $_min_length = 1;
|
||||
/**
|
||||
*/
|
||||
var $_min_length = 1;
|
||||
|
||||
/**
|
||||
*/
|
||||
function getBlockSize() {
|
||||
return $this->_block_size;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getBlockSize() {
|
||||
return $this->_block_size;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setBlockSize($block_size) {
|
||||
assert('$block_size >= 1');
|
||||
assert('$block_size <= 9');
|
||||
$this->_block_size = (int) $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 getWorkLevel() {
|
||||
return $this->_work_level;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setWorkLevel($work_level) {
|
||||
assert('$work_level >= 0');
|
||||
assert('$work_level <= 250');
|
||||
$this->_work_level = (int) $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 getMinLength() {
|
||||
return $this->_min_length;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setMinLength($min_length) {
|
||||
assert('$min_length >= 0');
|
||||
$this->_min_length = (int) $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);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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($work_level)) {
|
||||
$this->setWorkLevel($work_level);
|
||||
}
|
||||
|
||||
if (!is_null($min_length)) {
|
||||
$this->setMinLength($min_length);
|
||||
}
|
||||
}
|
||||
if (!is_null($min_length)) {
|
||||
$this->setMinLength($min_length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
if (strlen($data) < $this->_min_length) {
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
return bzcompress($data);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return $data ? bzdecompress($data) : $data;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return $data ? bzdecompress($data) : $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,89 +2,89 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
if (!function_exists('gzcompress')) {
|
||||
trigger_error('gzip functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
trigger_error('gzip functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
*/
|
||||
class ADODB_Compress_Gzip {
|
||||
/**
|
||||
*/
|
||||
var $_level = null;
|
||||
/**
|
||||
*/
|
||||
var $_level = null;
|
||||
|
||||
/**
|
||||
*/
|
||||
var $_min_length = 1;
|
||||
/**
|
||||
*/
|
||||
var $_min_length = 1;
|
||||
|
||||
/**
|
||||
*/
|
||||
function getLevel() {
|
||||
return $this->_level;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getLevel() {
|
||||
return $this->_level;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setLevel($level) {
|
||||
assert('$level >= 0');
|
||||
assert('$level <= 9');
|
||||
$this->_level = (int) $level;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function setLevel($level) {
|
||||
assert('$level >= 0');
|
||||
assert('$level <= 9');
|
||||
$this->_level = (int) $level;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function getMinLength() {
|
||||
return $this->_min_length;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getMinLength() {
|
||||
return $this->_min_length;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setMinLength($min_length) {
|
||||
assert('$min_length >= 0');
|
||||
$this->_min_length = (int) $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);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (!is_null($min_length)) {
|
||||
$this->setMinLength($min_length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
if (strlen($data) < $this->_min_length) {
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (!is_null($this->_level)) {
|
||||
return gzcompress($data, $this->_level);
|
||||
} else {
|
||||
return gzcompress($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return $data ? gzuncompress($data) : $data;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return $data ? gzuncompress($data) : $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ This file is provided for backwards compatibility purposes
|
||||
*/
|
||||
|
||||
if (!defined('ADODB_SESSION')) {
|
||||
require_once dirname(__FILE__) . '/adodb-session.php';
|
||||
require_once dirname(__FILE__) . '/adodb-session.php';
|
||||
}
|
||||
|
||||
require_once ADODB_SESSION . '/adodb-encrypt-md5.php';
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ This file is provided for backwards compatibility purposes
|
||||
*/
|
||||
|
||||
if (!defined('ADODB_SESSION')) {
|
||||
require_once dirname(__FILE__) . '/adodb-session2.php';
|
||||
require_once dirname(__FILE__) . '/adodb-session2.php';
|
||||
}
|
||||
|
||||
require_once ADODB_SESSION . '/adodb-encrypt-md5.php';
|
||||
|
||||
@@ -2,105 +2,105 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
if (!function_exists('mcrypt_encrypt')) {
|
||||
trigger_error('Mcrypt functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
trigger_error('Mcrypt functions are not available', E_USER_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
class ADODB_Encrypt_MCrypt {
|
||||
/**
|
||||
*/
|
||||
var $_cipher;
|
||||
/**
|
||||
*/
|
||||
var $_cipher;
|
||||
|
||||
/**
|
||||
*/
|
||||
var $_mode;
|
||||
/**
|
||||
*/
|
||||
var $_mode;
|
||||
|
||||
/**
|
||||
*/
|
||||
var $_source;
|
||||
/**
|
||||
*/
|
||||
var $_source;
|
||||
|
||||
/**
|
||||
*/
|
||||
function getCipher() {
|
||||
return $this->_cipher;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getCipher() {
|
||||
return $this->_cipher;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setCipher($cipher) {
|
||||
$this->_cipher = $cipher;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function setCipher($cipher) {
|
||||
$this->_cipher = $cipher;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function getMode() {
|
||||
return $this->_mode;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getMode() {
|
||||
return $this->_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setMode($mode) {
|
||||
$this->_mode = $mode;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function setMode($mode) {
|
||||
$this->_mode = $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function getSource() {
|
||||
return $this->_source;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function getSource() {
|
||||
return $this->_source;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setSource($source) {
|
||||
$this->_source = $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;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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;
|
||||
}
|
||||
$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 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");
|
||||
}
|
||||
/**
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
// security - hide paths
|
||||
if (!defined('ADODB_SESSION')) die();
|
||||
@@ -18,19 +18,19 @@ include_once ADODB_SESSION . '/crypt.inc.php';
|
||||
/**
|
||||
*/
|
||||
class ADODB_Encrypt_MD5 {
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->encrypt($data, $key);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->encrypt($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->decrypt($data, $key);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
$md5crypt = new MD5Crypt();
|
||||
return $md5crypt->decrypt($data, $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@define('HORDE_BASE', dirname(dirname(dirname(__FILE__))) . '/horde');
|
||||
|
||||
if (!is_dir(HORDE_BASE)) {
|
||||
trigger_error(sprintf('Directory not found: \'%s\'', HORDE_BASE), E_USER_ERROR);
|
||||
return 0;
|
||||
trigger_error(sprintf('Directory not found: \'%s\'', HORDE_BASE), E_USER_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
include_once HORDE_BASE . '/lib/Horde.php';
|
||||
@@ -27,19 +27,19 @@ the session didn't work properly.
|
||||
|
||||
This may be resolved with 4.3.3.
|
||||
|
||||
*/
|
||||
*/
|
||||
class ADODB_Encrypt_Secret {
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
return Secret::write($key, $data);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function write($data, $key) {
|
||||
return Secret::write($key, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return Secret::read($key, $data);
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function read($data, $key) {
|
||||
return Secret::read($key, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,24 +6,24 @@ include_once ADODB_SESSION . '/crypt.inc.php';
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
class ADODB_Encrypt_SHA1 {
|
||||
|
||||
function write($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->encrypt($data, $key);
|
||||
function write($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->encrypt($data, $key);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function read($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->decrypt($data, $key);
|
||||
function read($data, $key)
|
||||
{
|
||||
$sha1crypt = new SHA1Crypt();
|
||||
return $sha1crypt->decrypt($data, $key);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ This file is provided for backwards compatibility purposes
|
||||
*/
|
||||
|
||||
if (!defined('ADODB_SESSION')) {
|
||||
require_once dirname(__FILE__) . '/adodb-session.php';
|
||||
require_once dirname(__FILE__) . '/adodb-session.php';
|
||||
}
|
||||
ADODB_Session::clob('CLOB');
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
|
||||
/*
|
||||
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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
V5.10 10 Nov 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,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ This file is provided for backwards compatibility purposes
|
||||
*/
|
||||
|
||||
if (!defined('ADODB_SESSION')) {
|
||||
require_once dirname(__FILE__) . '/adodb-session2.php';
|
||||
require_once dirname(__FILE__) . '/adodb-session2.php';
|
||||
}
|
||||
ADODB_Session::clob('CLOB');
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,159 +1,159 @@
|
||||
<?php
|
||||
// Session Encryption by Ari Kuorikoski <ari.kuorikoski@finebyte.com>
|
||||
class MD5Crypt{
|
||||
function keyED($txt,$encrypt_key)
|
||||
{
|
||||
$encrypt_key = md5($encrypt_key);
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
||||
$ctr++;
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
function keyED($txt,$encrypt_key)
|
||||
{
|
||||
$encrypt_key = md5($encrypt_key);
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
||||
$ctr++;
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
function Encrypt($txt,$key)
|
||||
{
|
||||
srand((double)microtime()*1000000);
|
||||
$encrypt_key = md5(rand(0,32000));
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++)
|
||||
{
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($encrypt_key,$ctr,1) .
|
||||
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
||||
$ctr++;
|
||||
}
|
||||
return base64_encode($this->keyED($tmp,$key));
|
||||
}
|
||||
function Encrypt($txt,$key)
|
||||
{
|
||||
srand((double)microtime()*1000000);
|
||||
$encrypt_key = md5(rand(0,32000));
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++)
|
||||
{
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($encrypt_key,$ctr,1) .
|
||||
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
||||
$ctr++;
|
||||
}
|
||||
return base64_encode($this->keyED($tmp,$key));
|
||||
}
|
||||
|
||||
function Decrypt($txt,$key)
|
||||
{
|
||||
$txt = $this->keyED(base64_decode($txt),$key);
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
$md5 = substr($txt,$i,1);
|
||||
$i++;
|
||||
$tmp.= (substr($txt,$i,1) ^ $md5);
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
function Decrypt($txt,$key)
|
||||
{
|
||||
$txt = $this->keyED(base64_decode($txt),$key);
|
||||
$tmp = "";
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
$md5 = substr($txt,$i,1);
|
||||
$i++;
|
||||
$tmp.= (substr($txt,$i,1) ^ $md5);
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
function RandPass()
|
||||
{
|
||||
$randomPassword = "";
|
||||
srand((double)microtime()*1000000);
|
||||
for($i=0;$i<8;$i++)
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
function RandPass()
|
||||
{
|
||||
$randomPassword = "";
|
||||
srand((double)microtime()*1000000);
|
||||
for($i=0;$i<8;$i++)
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
|
||||
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
}
|
||||
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
}
|
||||
|
||||
$randomPassword .= chr($randnumber);
|
||||
}
|
||||
return $randomPassword;
|
||||
}
|
||||
$randomPassword .= chr($randnumber);
|
||||
}
|
||||
return $randomPassword;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SHA1Crypt{
|
||||
|
||||
function keyED($txt,$encrypt_key)
|
||||
{
|
||||
function keyED($txt,$encrypt_key)
|
||||
{
|
||||
|
||||
$encrypt_key = sha1($encrypt_key);
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
$encrypt_key = sha1($encrypt_key);
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
||||
$ctr++;
|
||||
}
|
||||
return $tmp;
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
|
||||
$ctr++;
|
||||
}
|
||||
return $tmp;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Encrypt($txt,$key)
|
||||
{
|
||||
function Encrypt($txt,$key)
|
||||
{
|
||||
|
||||
srand((double)microtime()*1000000);
|
||||
$encrypt_key = sha1(rand(0,32000));
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
srand((double)microtime()*1000000);
|
||||
$encrypt_key = sha1(rand(0,32000));
|
||||
$ctr=0;
|
||||
$tmp = "";
|
||||
|
||||
for ($i=0;$i<strlen($txt);$i++)
|
||||
for ($i=0;$i<strlen($txt);$i++)
|
||||
|
||||
{
|
||||
{
|
||||
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
if ($ctr==strlen($encrypt_key)) $ctr=0;
|
||||
|
||||
$tmp.= substr($encrypt_key,$ctr,1) .
|
||||
$tmp.= substr($encrypt_key,$ctr,1) .
|
||||
|
||||
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
||||
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
|
||||
|
||||
$ctr++;
|
||||
$ctr++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return base64_encode($this->keyED($tmp,$key));
|
||||
return base64_encode($this->keyED($tmp,$key));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Decrypt($txt,$key)
|
||||
{
|
||||
function Decrypt($txt,$key)
|
||||
{
|
||||
|
||||
$txt = $this->keyED(base64_decode($txt),$key);
|
||||
$txt = $this->keyED(base64_decode($txt),$key);
|
||||
|
||||
$tmp = "";
|
||||
$tmp = "";
|
||||
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
for ($i=0;$i<strlen($txt);$i++){
|
||||
|
||||
$sha1 = substr($txt,$i,1);
|
||||
$sha1 = substr($txt,$i,1);
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
|
||||
$tmp.= (substr($txt,$i,1) ^ $sha1);
|
||||
$tmp.= (substr($txt,$i,1) ^ $sha1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function RandPass()
|
||||
{
|
||||
$randomPassword = "";
|
||||
srand((double)microtime()*1000000);
|
||||
function RandPass()
|
||||
{
|
||||
$randomPassword = "";
|
||||
srand((double)microtime()*1000000);
|
||||
|
||||
for($i=0;$i<8;$i++)
|
||||
{
|
||||
for($i=0;$i<8;$i++)
|
||||
{
|
||||
|
||||
$randnumber = rand(48,120);
|
||||
$randnumber = rand(48,120);
|
||||
|
||||
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
}
|
||||
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
|
||||
{
|
||||
$randnumber = rand(48,120);
|
||||
}
|
||||
|
||||
$randomPassword .= chr($randnumber);
|
||||
}
|
||||
$randomPassword .= chr($randnumber);
|
||||
}
|
||||
|
||||
return $randomPassword;
|
||||
return $randomPassword;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<schema version="0.2">
|
||||
<table name="sessions">
|
||||
<desc>table for ADOdb session-management</desc>
|
||||
<table name="sessions">
|
||||
<desc>table for ADOdb session-management</desc>
|
||||
|
||||
<field name="SESSKEY" type="C" size="32">
|
||||
<descr>session key</descr>
|
||||
<KEY/>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
|
||||
<field name="EXPIRY" type="I" size="11">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
<field name="SESSKEY" type="C" size="32">
|
||||
<descr>session key</descr>
|
||||
<KEY />
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
<field name="EXPIREREF" type="C" size="64">
|
||||
<descr></descr>
|
||||
</field>
|
||||
<field name="EXPIRY" type="I" size="11">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
<field name="DATA" type="XL">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
</table>
|
||||
<field name="EXPIREREF" type="C" size="64">
|
||||
<descr></descr>
|
||||
</field>
|
||||
|
||||
<field name="DATA" type="XL">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
</table>
|
||||
</schema>
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<?xml version="1.0"?>
|
||||
<schema version="0.3">
|
||||
<table name="sessions2">
|
||||
<desc>table for ADOdb session-management</desc>
|
||||
<table name="sessions2">
|
||||
<desc>table for ADOdb session-management</desc>
|
||||
|
||||
<field name="SESSKEY" type="C" size="64">
|
||||
<descr>session key</descr>
|
||||
<KEY/>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
|
||||
<field name="SESSKEY" type="C" size="64">
|
||||
<descr>session key</descr>
|
||||
<KEY />
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
|
||||
<field name="EXPIRY" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
|
||||
<field name="CREATED" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
|
||||
<field name="MODIFIED" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
|
||||
<field name="EXPIREREF" type="C" size="250">
|
||||
<descr></descr>
|
||||
</field>
|
||||
|
||||
<field name="SESSDATA" type="XL">
|
||||
<descr></descr>
|
||||
<NOTNULL/>
|
||||
</field>
|
||||
</table>
|
||||
<field name="EXPIRY" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
<field name="CREATED" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
<field name="MODIFIED" type="T">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
|
||||
<field name="EXPIREREF" type="C" size="250">
|
||||
<descr></descr>
|
||||
</field>
|
||||
|
||||
<field name="SESSDATA" type="XL">
|
||||
<descr></descr>
|
||||
<NOTNULL />
|
||||
</field>
|
||||
</table>
|
||||
</schema>
|
||||
|
||||
Reference in New Issue
Block a user