moodler
2006-01-28 06:04:42 +00:00
parent 13ca56cf52
commit 7d94fa91d5
93 changed files with 714 additions and 243 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1;
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+2 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -61,6 +61,7 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
$tokens[$stmtno] = array();
$max = strlen($args);
$quoted = false;
$tokarr = array();
while ($pos < $max) {
$ch = substr($args,$pos,1);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+19 -7
View File
@@ -7,7 +7,7 @@ global $ADODB_INCLUDED_LIB;
$ADODB_INCLUDED_LIB = 1;
/*
@version V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim\@natsoft.com.my). All rights reserved.
@version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim\@natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
@@ -57,8 +57,10 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
$where = false;
foreach ($keyCol as $v) {
if ($where) $where .= " and $v=$fieldArray[$v]";
else $where = "$v=$fieldArray[$v]";
if (isset($fieldArray[$v])) {
if ($where) $where .= ' and '.$v.'='.$fieldArray[$v];
else $where = $v.'='.$fieldArray[$v];
}
}
if ($uSet && $where) {
@@ -284,6 +286,12 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
query rewriting techniques...
Does not work with UNIONs, except with postgresql and oracle.
Usage:
$conn->Connect(...);
$cnt = _adodb_getcount($conn, $sql);
*/
function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
{
@@ -595,9 +603,11 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
$discard = false;
// not a good hack, improvements?
if ($whereClause) {
#var_dump($whereClause);
if (preg_match('/\s(ORDER\s.*)/is', $whereClause[1], $discard));
else if (preg_match('/\s(LIMIT\s.*)/is', $whereClause[1], $discard));
else preg_match('/\s(FOR UPDATE.*)/is', $whereClause[1], $discard);
else if (preg_match('/\s(FOR UPDATE.*)/is', $whereClause[1], $discard));
else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see http://sourceforge.net/tracker/index.php?func=detail&aid=1379638&group_id=42718&atid=433976
} else
$whereClause = array(false,false);
@@ -919,11 +929,13 @@ function _adodb_debug_execute(&$zthis, $sql, $inputarr)
$dbt = $zthis->databaseType;
if (isset($zthis->dsnType)) $dbt .= '-'.$zthis->dsnType;
if ($inBrowser) {
$ss = htmlspecialchars($ss);
if ($ss) {
$ss = '<code>'.htmlspecialchars($ss).'</code>';
}
if ($zthis->debug === -1)
ADOConnection::outp( "<br>\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; <code>$ss</code>\n<br>\n",false);
ADOConnection::outp( "<br />\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; $ss\n<br />\n",false);
else
ADOConnection::outp( "<hr>\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; <code>$ss</code>\n<hr>\n",false);
ADOConnection::outp( "<hr />\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; $ss\n<hr />\n",false);
} else {
ADOConnection::outp("-----\n($dbt): ".$sqlTxt."\n-----\n",false);
}
+4 -3
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -265,10 +265,11 @@ class ADODB_Pager {
$grid = $this->RenderGrid();
$footer = $this->RenderPageCount();
$rs->Close();
$this->rs = false;
$this->RenderLayout($header,$grid,$footer);
$rs->Close();
$this->rs = false;
}
//------------------------------------------------------
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+5 -5
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
@@ -16,7 +16,7 @@ V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights res
*/
if (!defined(ADODB_DIR)) include_once(dirname(__FILE__).'/adodb.inc.php');
if (!defined('ADODB_DIR')) include_once(dirname(__FILE__).'/adodb.inc.php');
include_once(ADODB_DIR.'/tohtml.inc.php');
define( 'ADODB_OPT_HIGH', 2);
@@ -136,7 +136,7 @@ function& adodb_log_sql(&$conn,$sql,$inputarr)
if (empty($d)) $d = date("'Y-m-d H:i:s'");
if ($conn->dataProvider == 'oci8' && $dbT != 'oci8po') {
$isql = "insert into $perf_table values($d,:b,:c,:d,:e,:f)";
} else if ($dbT == 'odbc_mssql' || $dbT == 'informix') {
} else if ($dbT == 'odbc_mssql' || $dbT == 'informix' || $dbT == 'odbtp') {
$timer = $arr['f'];
if ($dbT == 'informix') $sql2 = substr($sql2,0,230);
@@ -588,7 +588,7 @@ Committed_AS: 348732 kB
$rs = $this->conn->Execute($sql1);
if (isset($savem)) $this->SetFetchMode($savem);
if (isset($savem)) $this->conn->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs) {
while (!$rs->EOF) {
@@ -949,7 +949,7 @@ Committed_AS: 348732 kB
return $arr;
}
function undomq(&$m)
function undomq($m)
{
if (get_magic_quotes_gpc()) {
// undo the damage
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -691,7 +691,7 @@ adodb_date_gentable();
for ($i=1970; $i > 1500; $i--) {
echo "<hr>$i ";
echo "<hr />$i ";
adodb_date_test_date($i,1,1);
}
+19
View File
@@ -17,6 +17,20 @@
* @package axmls
* @tutorial getting_started.pkg
*/
function _file_get_contents($file)
{
if (function_exists('file_get_contents')) return file_get_contents($file);
$f = fopen($file,'r');
if (!$f) return '';
$t = '';
while ($s = fread($f,100000)) $t .= $s;
fclose($f);
return $t;
}
/**
* Debug on or off
@@ -1429,6 +1443,10 @@ class adoSchema {
if ( $returnSchema )
{
$xmlstring = '';
while( $data = fread( $fp, 100000 ) ) {
$xmlstring .= $data;
}
return $xmlstring;
}
@@ -1572,6 +1590,7 @@ class adoSchema {
* @return array Array of SQL statements or FALSE if an error occurs
*/
function PrintSQL( $format = 'NONE' ) {
$sqlArray = null;
return $this->getSQL( $format, $sqlArray );
}
+88 -12
View File
@@ -14,7 +14,7 @@
/**
\mainpage
@version V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
@version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license. You can choose which license
you prefer.
@@ -171,7 +171,7 @@
/**
* ADODB version as a string.
*/
$ADODB_vers = 'V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
$ADODB_vers = 'V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
/**
* Determines whether recordset->RecordCount() is used.
@@ -314,7 +314,6 @@
var $_evalAll = false;
var $_affected = false;
var $_logsql = false;
/**
@@ -1497,11 +1496,67 @@
return $rs;
}
/**
* Flush cached recordsets that match a particular $sql statement.
* If $sql == false, then we purge all files in the cache.
*/
function CacheFlush($sql=false,$inputarr=false)
/**
* Flush cached recordsets that match a particular $sql statement.
* If $sql == false, then we purge all files in the cache.
*/
function CacheFlush($sql=false,$inputarr=false)
{
global $ADODB_CACHE_DIR;
if (strlen($ADODB_CACHE_DIR) > 1 && !$sql) {
/*if (strncmp(PHP_OS,'WIN',3) === 0)
$dir = str_replace('/', '\\', $ADODB_CACHE_DIR);
else */
$dir = $ADODB_CACHE_DIR;
if ($this->debug) {
ADOConnection::outp( "CacheFlush: $dir<br><pre>\n", $this->_dirFlush($dir),"</pre>");
} else {
$this->_dirFlush($dir);
}
return;
}
global $ADODB_INCLUDED_CSV;
if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
$f = $this->_gencachename($sql.serialize($inputarr),false);
adodb_write_file($f,''); // is adodb_write_file needed?
if (!@unlink($f)) {
if ($this->debug) ADOConnection::outp( "CacheFlush: failed for $f");
}
}
/**
* Private function to erase all of the files and subdirectories in a directory.
*
* Just specify the directory, and tell it if you want to delete the directory or just clear it out.
* Note: $kill_top_level is used internally in the function to flush subdirectories.
*/
function _dirFlush($dir, $kill_top_level = false) {
if(!$dh = @opendir($dir)) return;
while (($obj = readdir($dh))) {
if($obj=='.' || $obj=='..')
continue;
if (!@unlink($dir.'/'.$obj))
$this->_dirFlush($dir.'/'.$obj, true);
}
if ($kill_top_level === true)
@rmdir($dir);
return true;
}
function xCacheFlush($sql=false,$inputarr=false)
{
global $ADODB_CACHE_DIR;
@@ -2032,13 +2087,13 @@
* List columns in a database as an array of ADOFieldObjects.
* See top of file for definition of object.
*
* @param table table name to query
* @param upper uppercase table name (required by some databases)
* @param $table table name to query
* @param $normalize makes table name case-insensitive (required by some databases)
* @schema is optional database schema to use - not supported by all databases.
*
* @return array of ADOFieldObjects for current table.
*/
function &MetaColumns($table,$upper=true)
function &MetaColumns($table,$normalize=true)
{
global $ADODB_FETCH_MODE;
@@ -2052,7 +2107,7 @@
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
$rs = $this->Execute(sprintf($this->metaColumnsSQL,($upper)?strtoupper($table):$table));
$rs = $this->Execute(sprintf($this->metaColumnsSQL,($normalize)?strtoupper($table):$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs === false || $rs->EOF) return $false;
@@ -3367,7 +3422,7 @@
return 'B';
case 'D':
if (!empty($this->datetime)) return 'T';
if (!empty($this->connection) && !empty($this->connection->datetime)) return 'T';
return 'D';
default:
@@ -3669,9 +3724,23 @@
if (!defined('ADODB_ASSOC_CASE')) define('ADODB_ASSOC_CASE',2);
$errorfn = (defined('ADODB_ERROR_HANDLER')) ? ADODB_ERROR_HANDLER : false;
$false = false;
if (strpos($db,'://')) {
if ($at = strpos($db,'://')) {
$origdsn = $db;
$dsna = @parse_url($db);
if (PHP_VERSION < 5) $dsna = @parse_url($db);
else {
$fakedsn = 'fake'.substr($db,$at);
$dsna = @parse_url($fakedsn);
$dsna['scheme'] = substr($db,0,$at);
if (strncmp($db,'pdo',3) == 0) {
$sch = explode('_',$dsna['scheme']);
if (sizeof($sch)>1) {
$dsna['host'] = isset($dsna['host']) ? rawurldecode($dsna['host']) : '';
$dsna['host'] = rawurlencode($sch[1].':host='.rawurldecode($dsna['host']));
$dsna['scheme'] = 'pdo';
}
}
}
if (!$dsna) {
// special handling of oracle, which might not have host
@@ -3792,7 +3861,14 @@
}
switch($drivername) {
case 'mysqli': $drivername='mysql'; break;
case 'mysqlt':
case 'mysqli':
$drivername='mysql';
break;
case 'postgres7':
case 'postgres8':
$drivername = 'postgres';
break;
case 'firebird15': $drivername = 'firebird'; break;
case 'oracle': $drivername = 'oci8'; break;
case 'access': if ($perf) $drivername = ''; break;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+11 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -357,5 +357,15 @@ CREATE [ UNIQUE ] INDEX index_name ON table
return $sql;
}
function _GetSize($ftype, $ty, $fsize, $fprec)
{
if (strlen($fsize) && $ty != 'X' && $ty != 'B' && $ty != 'I' && strpos($ftype,'(') === false) {
$ftype .= "(".$fsize;
if (strlen($fprec)) $ftype .= ",".$fprec;
$ftype .= ')';
}
return $ftype;
}
}
?>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.50 6 July 2004 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.50 6 July 2004 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
@version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
@version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+3 -3
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -215,7 +215,7 @@ class ADODB_ibase extends ADOConnection {
return $false;
}
$indexes = array ();
$indexes = array();
while ($row = $rs->FetchRow()) {
$index = $row[0];
if (!isset($indexes[$index])) {
@@ -225,7 +225,7 @@ class ADODB_ibase extends ADOConnection {
'columns' => array()
);
}
$sql = "SELECT * FROM RDB\$INDEX_SEGMENTS WHERE RDB\$INDEX_NAME = '".$name."' ORDER BY RDB\$FIELD_POSITION ASC";
$sql = "SELECT * FROM RDB\$INDEX_SEGMENTS WHERE RDB\$INDEX_NAME = '".$index."' ORDER BY RDB\$FIELD_POSITION ASC";
$rs1 = $this->Execute($sql);
while ($row1 = $rs1->FetchRow()) {
$indexes[$index]['columns'][$row1[2]] = $row1[1];
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim. All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim. All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -583,7 +583,7 @@ order by constraint_name, referenced_table_name, keyno";
{
if (!$this->_has_mssql_init) {
ADOConnection::outp( "Parameter: mssql_bind only available since PHP 4.1.0");
return $sql;
return false;
}
$isNull = is_null($var); // php 4.0.4 and above...
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+10 -5
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -56,6 +56,7 @@ class ADODB_mysql extends ADOConnection {
return " IFNULL($field, $ifNull) "; // if MySQL
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$save = $this->metaTablesSQL;
@@ -308,6 +309,10 @@ class ADODB_mysql extends ADOConnection {
$s .= '%w';
break;
case 'W':
$s .= '%U';
break;
case 'l':
$s .= '%W';
break;
@@ -534,7 +539,7 @@ class ADODB_mysql extends ADOConnection {
}
// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE )
{
if ( !empty($owner) ) {
$table = "$owner.$table";
@@ -560,7 +565,7 @@ class ADODB_mysql extends ADOConnection {
$foreign_keys[$ref_table] = array();
$num_fields = count($my_field);
for ( $j = 0; $j < $num_fields; $j ++ ) {
if ( $asociative ) {
if ( $associative ) {
$foreign_keys[$ref_table][$ref_field[$j]] = $my_field[$j];
} else {
$foreign_keys[$ref_table][] = "{$my_field[$j]}={$ref_field[$j]}";
@@ -622,8 +627,8 @@ class ADORecordSet_mysql extends ADORecordSet{
}
else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */
$o = @mysql_fetch_field($this->_queryID);
$o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson ([email protected])
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
$o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson ([email protected])
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
}
return $o;
+90 -13
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -19,6 +19,8 @@ Based on adodb 3.40
if (! defined("_ADODB_MYSQLI_LAYER")) {
define("_ADODB_MYSQLI_LAYER", 1 );
// PHP5 compat...
if (! defined("MYSQLI_BINARY_FLAG")) define("MYSQLI_BINARY_FLAG", 128);
if (!defined('MYSQLI_READ_DEFAULT_GROUP')) define('MYSQLI_READ_DEFAULT_GROUP',1);
// disable adodb extension - currently incompatible.
@@ -163,6 +165,14 @@ class ADODB_mysqli extends ADOConnection {
return true;
}
function RowLock($tables,$where='',$flds='1 as adodb_ignore')
{
if ($this->transCnt==0) $this->BeginTrans();
if ($where) $where = ' where '.$where;
$rs =& $this->Execute("select $flds from $tables $where for update");
return !empty($rs);
}
// if magic quotes disabled, use mysql_real_escape_string()
// From readme.htm:
// Quotes a string to be sent to the database. The $magic_quotes_enabled
@@ -433,7 +443,7 @@ class ADODB_mysqli extends ADOConnection {
}
// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE )
{
if ( !empty($owner) ) {
$table = "$owner.$table";
@@ -459,7 +469,7 @@ class ADODB_mysqli extends ADOConnection {
$foreign_keys[$ref_table] = array();
$num_fields = count($my_field);
for ( $j = 0; $j < $num_fields; $j ++ ) {
if ( $asociative ) {
if ( $associative ) {
$foreign_keys[$ref_table][$ref_field[$j]] = $my_field[$j];
} else {
$foreign_keys[$ref_table][] = "{$my_field[$j]}={$ref_field[$j]}";
@@ -659,6 +669,45 @@ class ADODB_mysqli extends ADOConnection {
}
// this is a set of functions for managing client encoding - very important if the encodings
// of your database and your output target (i.e. HTML) don't match
// for instance, you may have UTF8 database and server it on-site as latin1 etc.
// GetCharSet - get the name of the character set the client is using now
// Under Windows, the functions should work with MySQL 4.1.11 and above, the set of charsets supported
// depends on compile flags of mysql distribution
function GetCharSet()
{
//we will use ADO's builtin property charSet
if (!is_callable($this->_connectionID,'character_set_name'))
return false;
$this->charSet = @$this->_connectionID->character_set_name();
if (!$this->charSet) {
return false;
} else {
return $this->charSet;
}
}
// SetCharSet - switch the client encoding
function SetCharSet($charset_name)
{
if (!is_callable($this->_connectionID,'set_charset'))
return false;
if ($this->charSet !== $charset_name) {
$if = @$this->_connectionID->set_charset($charset_name);
if ($if == "0" & $this->GetCharSet() == $charset_name) {
return true;
} else return false;
} else return true;
}
}
/*--------------------------------------------------------------------------------------
@@ -704,22 +753,50 @@ class ADORecordSet_mysqli extends ADORecordSet{
$this->_numOfFields = @mysqli_num_fields($this->_queryID);
}
/*
1 = MYSQLI_NOT_NULL_FLAG
2 = MYSQLI_PRI_KEY_FLAG
4 = MYSQLI_UNIQUE_KEY_FLAG
8 = MYSQLI_MULTIPLE_KEY_FLAG
16 = MYSQLI_BLOB_FLAG
32 = MYSQLI_UNSIGNED_FLAG
64 = MYSQLI_ZEROFILL_FLAG
128 = MYSQLI_BINARY_FLAG
256 = MYSQLI_ENUM_FLAG
512 = MYSQLI_AUTO_INCREMENT_FLAG
1024 = MYSQLI_TIMESTAMP_FLAG
2048 = MYSQLI_SET_FLAG
32768 = MYSQLI_NUM_FLAG
16384 = MYSQLI_PART_KEY_FLAG
32768 = MYSQLI_GROUP_FLAG
65536 = MYSQLI_UNIQUE_FLAG
131072 = MYSQLI_BINCMP_FLAG
*/
function &FetchField($fieldOffset = -1)
{
$fieldnr = $fieldOffset;
if ($fieldOffset != -1) {
$fieldOffset = mysqli_field_seek($this->_queryID, $fieldnr);
}
$o = mysqli_fetch_field($this->_queryID);
return $o;
$fieldnr = $fieldOffset;
if ($fieldOffset != -1) {
$fieldOffset = mysqli_field_seek($this->_queryID, $fieldnr);
}
$o = mysqli_fetch_field($this->_queryID);
/* Properties of an ADOFieldObject as set by MetaColumns */
$o->primary_key = $o->flags & MYSQLI_PRI_KEY_FLAG;
$o->not_null = $o->flags & MYSQLI_NOT_NULL_FLAG;
$o->auto_increment = $o->flags & MYSQLI_AUTO_INCREMENT_FLAG;
$o->binary = $o->flags & MYSQLI_BINARY_FLAG;
// $o->blob = $o->flags & MYSQLI_BLOB_FLAG; /* not returned by MetaColumns */
$o->unsigned = $o->flags & MYSQLI_UNSIGNED_FLAG;
return $o;
}
function &GetRowAssoc($upper = true)
{
if ($this->fetchMode == MYSQLI_ASSOC && !$upper)
return $this->fields;
$row =& ADORecordSet::GetRowAssoc($upper);
return $row;
if ($this->fetchMode == MYSQLI_ASSOC && !$upper)
return $this->fields;
$row =& ADORecordSet::GetRowAssoc($upper);
return $row;
}
/* Use associative array to get fields array */
+5 -3
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -59,10 +59,12 @@ class ADODB_mysqlt extends ADODB_mysql {
return true;
}
function RowLock($tables,$where,$flds='1 as ignore')
function RowLock($tables,$where='',$flds='1 as adodb_ignore')
{
if ($this->transCnt==0) $this->BeginTrans();
return $this->GetOne("select $flds from $tables where $where for update");
if ($where) $where = ' where '.$where;
$rs =& $this->Execute("select $flds from $tables $where for update");
return !empty($rs);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com
Based on the previous postgres drivers.
+7 -2
View File
@@ -1,7 +1,7 @@
<?php
/*
version V4.66 28 Sept 2005 (c) 2000-2005 John Lim. All rights reserved.
version V4.71 24 Jan 2006 (c) 2000-2006 John Lim. All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@@ -195,7 +195,7 @@ NATSOFT.DOMAIN =
$argHostname=$argHostinfo[0];
$argHostport=$argHostinfo[1];
} else {
$argHostport="1521";
$argHostport = empty($this->port)? "1521" : $this->port;
}
if ($this->connectSID) {
@@ -504,6 +504,10 @@ NATSOFT.DOMAIN =
$s .= 'DAY';
break;
case 'W':
$s .= 'WW';
break;
default:
// handle escape characters...
if ($ch == '\\') {
@@ -793,6 +797,7 @@ NATSOFT.DOMAIN =
if (is_array($stmt) && sizeof($stmt) >= 5) {
$hasref = true;
$ignoreCur = false;
$this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
if ($params) {
foreach($params as $k => $v) {
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim. All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim. All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+3 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -52,7 +52,8 @@ class ADODB_odbc_oracle extends ADODB_odbc {
function &MetaColumns($table)
{
global $ADODB_FETCH_MODE;
$rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
if ($rs === false) {
$false = false;
+5 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
@@ -312,6 +312,7 @@ class ADODB_odbtp extends ADOConnection{
$false = false;
return $false;
}
$retarr = array();
while (!$rs->EOF) {
//print_r($rs->fields);
if (strtoupper($rs->fields[2]) == $table) {
@@ -326,7 +327,7 @@ class ADODB_odbtp extends ADOConnection{
$fld->default_value = $rs->fields[12];
}
$retarr[strtoupper($fld->name)] = $fld;
} else if (sizeof($retarr)>0)
} else if (!empty($retarr))
break;
$rs->MoveNext();
}
@@ -518,6 +519,8 @@ class ADODB_odbtp extends ADOConnection{
function _query($sql,$inputarr=false)
{
global $php_errormsg;
if ($inputarr) {
if (is_array($sql)) {
$stmtid = $sql[1];
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+20 -4
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -66,9 +66,13 @@ function adodb_pdo_type($t)
class ADODB_pdo_base extends ADODB_pdo {
var $sysDate = "'?'";
var $sysTimeStamp = "'?'";
function _init($parentDriver)
{
$parentDriver->_bindInputArray = false;
$parentDriver->_bindInputArray = true;
#$parentDriver->_connectionID->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
}
@@ -77,7 +81,7 @@ class ADODB_pdo_base extends ADODB_pdo {
return ADOConnection::ServerInfo();
}
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $ret;
@@ -135,6 +139,12 @@ class ADODB_pdo extends ADOConnection {
function Time()
{
if (!empty($this->_driver->_hasdual)) $sql = "select $this->sysTimeStamp from dual";
else $sql = "select $this->sysTimeStamp";
$rs =& $this->_Execute($sql);
if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
return false;
}
@@ -144,6 +154,9 @@ class ADODB_pdo extends ADOConnection {
$at = strpos($argDSN,':');
$this->dsnType = substr($argDSN,0,$at);
if ($argDatabasename) {
$argDSN .= ';dbname='.$argDatabasename;
}
try {
$this->_connectionID = new PDO($argDSN, $argUsername, $argPassword);
} catch (Exception $e) {
@@ -171,6 +184,7 @@ class ADODB_pdo extends ADOConnection {
case 'oci':
case 'mysql':
case 'pgsql':
case 'mssql':
include_once(ADODB_DIR.'/drivers/adodb-pdo_'.$this->dsnType.'.inc.php');
break;
}
@@ -196,10 +210,11 @@ class ADODB_pdo extends ADOConnection {
/*------------------------------------------------------------------------------*/
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$save = $this->_driver->fetchMode;
$this->_driver->fetchMode = $this->fetchMode;
$this->_driver->debug = $this->debug;
$ret = $this->_driver->SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$this->_driver->fetchMode = $save;
return $ret;
@@ -321,6 +336,7 @@ class ADODB_pdo extends ADOConnection {
}
if ($stmt) {
$this->_driver->debug = $this->debug;
if ($inputarr) $ok = $stmt->execute($inputarr);
else $ok = $stmt->execute();
}
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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 8.
*/
class ADODB_pdo_mssql extends ADODB_pdo {
var $hasTop = 'top';
var $sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
var $sysTimeStamp = 'GetDate()';
function _init($parentDriver)
{
$parentDriver->hasTransactions = false; ## <<< BUG IN PDO mssql driver
$parentDriver->_bindInputArray = false;
$parentDriver->hasInsertID = true;
}
function ServerInfo()
{
return ADOConnection::ServerInfo();
}
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $ret;
}
function MetaTables()
{
return false;
}
function MetaColumns()
{
return false;
}
}
?>
+2 -2
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -21,7 +21,7 @@ class ADODB_pdo_mysql extends ADODB_pdo {
{
$parentDriver->hasTransactions = false;
$parentDriver->_bindInputArray = false;
$parentDriver->_bindInputArray = true;
$parentDriver->hasInsertID = true;
$parentDriver->_connectionID->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
}
+3 -2
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -21,10 +21,11 @@ class ADODB_pdo_oci extends ADODB_pdo_base {
var $metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno";
var $_initdate = true;
var $_hasdual = true;
function _init($parentDriver)
{
$parentDriver->_bindInputArray = false;
$parentDriver->_bindInputArray = true;
if ($this->_initdate) {
$parentDriver->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'");
+3 -3
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -10,7 +10,7 @@ V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights res
*/
class ADODB_pdo_pgsql extends ADODB_pdo {
var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1";
var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1";
var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%'
and tablename not in ('sql_features', 'sql_implementation_info', 'sql_languages',
'sql_packages', 'sql_sizing', 'sql_sizing_profiles')
@@ -57,7 +57,7 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s'))
function _init($parentDriver)
{
$parentDriver->hasTransactions = false;
$parentDriver->hasTransactions = false; ## <<< BUG IN PDO pgsql driver
$parentDriver->hasInsertID = true;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+31 -11
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -49,7 +49,7 @@ function adodb_addslashes($s)
{
$len = strlen($s);
if ($len == 0) return "''";
if (strncmp($s,"'",1) === 0 && substr(s,$len-1) == "'") return $s; // already quoted
if (strncmp($s,"'",1) === 0 && substr($s,$len-1) == "'") return $s; // already quoted
return "'".addslashes($s)."'";
}
@@ -232,7 +232,7 @@ select viewname,'V' from pg_views where viewname like $mask";
return $ret;
}
/*
// if magic quotes disabled, use pg_escape_string()
function qstr($s,$magic_quotes=false)
{
@@ -241,7 +241,7 @@ select viewname,'V' from pg_views where viewname like $mask";
return "'".pg_escape_string($s)."'";
}
if ($this->replaceQuote[0] == '\\'){
$s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
$s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\\000"),$s);
}
return "'".str_replace("'",$this->replaceQuote,$s)."'";
}
@@ -250,7 +250,7 @@ select viewname,'V' from pg_views where viewname like $mask";
$s = str_replace('\\"','"',$s);
return "'$s'";
}
*/
// Format date column in sql string given an input format that understands Y M D
@@ -312,7 +312,11 @@ select viewname,'V' from pg_views where viewname like $mask";
case 'l':
$s .= 'DAY';
break;
case 'W':
$s .= 'WW';
break;
default:
// handle escape characters...
if ($ch == '\\') {
@@ -357,6 +361,22 @@ select viewname,'V' from pg_views where viewname like $mask";
return $rez;
}
/*
* Deletes/Unlinks a Blob from the database, otherwise it
* will be left behind
*
* Returns TRUE on success or FALSE on failure.
*
* contributed by Todd Rogers todd#windfox.net
*/
function BlobDelete( $blob )
{
pg_exec ($this->_connectionID, "begin");
$result = @pg_lo_unlink($blob);
pg_exec ($this->_connectionID, "commit");
return( $result );
}
/*
Hueristic - not guaranteed to work.
*/
@@ -393,7 +413,7 @@ select viewname,'V' from pg_views where viewname like $mask";
@pg_loclose($fd);
if ($hastrans) @pg_exec($this->_connectionID,"commit");
return $realblob;
}
}
/*
See http://www.postgresql.org/idocs/index.php?datatype-binary.html
@@ -439,6 +459,7 @@ select viewname,'V' from pg_views where viewname like $mask";
// for schema support, pass in the $table param "$schema.$tabname".
// converts field names to lowercase, $upper is ignored
// see http://phplens.com/lens/lensforum/msgs.php?id=14018 for more info
function &MetaColumns($table,$normalize=true)
{
global $ADODB_FETCH_MODE;
@@ -525,9 +546,8 @@ select viewname,'V' from pg_views where viewname like $mask";
}
//Freek
if ($rs->fields[4] == 't') {
$fld->not_null = true;
}
$fld->not_null = $rs->fields[4] == 't';
// Freek
if (is_array($keys)) {
@@ -621,7 +641,7 @@ WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\'))';
function _connect($str,$user='',$pwd='',$db='',$ctype=0)
{
if (!function_exists('pg_pconnect')) return null;
if (!function_exists('pg_connect')) return null;
$this->_errorMsg = false;
+6 -3
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim#natsoft.com.my). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -101,11 +101,14 @@ class ADODB_postgres7 extends ADODB_postgres64 {
$sqlarr = explode('?',trim($sql));
$sql = '';
$i = 1;
$last = sizeof($sqlarr)-1;
foreach($sqlarr as $v) {
$sql .= $v.' $'.$i;
if ($last < $i) $sql .= $v;
else $sql .= $v.' $'.$i;
$i++;
}
$rez = pg_query_params($this->_connectionID,substr($sql, 0, strlen($sql)-2), $inputarr);
$rez = pg_query_params($this->_connectionID,$sql, $inputarr);
} else {
$rez = pg_query($this->_connectionID,$sql);
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights
version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -19
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
@@ -147,24 +147,6 @@ class ADODB_sqlite extends ADOConnection {
return ($col) ? "adodb_date2($fmt,$col)" : "adodb_date($fmt)";
}
function &MetaColumns($tab)
{
global $ADODB_FETCH_MODE;
$rs = $this->Execute("select * from $tab limit 1");
if (!$rs) {
$false = false;
return $false;
}
$arr = array();
for ($i=0,$max=$rs->_numOfFields; $i < $max; $i++) {
$fld =& $rs->FetchField($i);
if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] =& $fld;
else $arr[strtoupper($fld->name)] =& $fld;
}
$rs->Close();
return $arr;
}
function _createFunctions()
{
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim. All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim. All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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. See License.txt.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+95 -5
View File
@@ -1,10 +1,100 @@
<?php
require_once('../../config.php');
require_once('../weblib.php');
/**
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
*/
/* Documentation on usage is at http://php.weblogs.com/adodb_csv
*
* Legal query string parameters:
*
* sql = holds sql string
* nrows = number of rows to return
* offset = skip offset rows of data
* fetch = $ADODB_FETCH_MODE
*
* example:
*
* http://localhost/php/server.php?select+*+from+table&nrows=10&offset=2
*/
add_to_log(0, 'adodb', 'intrusion attempt', 'lib/adodb/server.php');
trigger_error('SECURITY WARNING: intrusion attempt against lib/adodb/server.php from ' . getremoteaddr());
error('SECURITY WARNING: logged intrusion attempt against lib/adodb/server.php');
/*
* Define the IP address you want to accept requests from
* as a security measure. If blank we accept anyone promisciously!
*/
$ACCEPTIP = '127.0.0.1';
/*
* Connection parameters
*/
$driver = 'mysql';
$host = 'localhost'; // DSN for odbc
$uid = 'root';
$pwd = 'garbase-it-is';
$database = 'test';
/*============================ DO NOT MODIFY BELOW HERE =================================*/
// $sep must match csv2rs() in adodb.inc.php
$sep = ' :::: ';
include('./adodb.inc.php');
include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
function err($s)
{
die('**** '.$s.' ');
}
// undo stupid magic quotes
function undomq(&$m)
{
if (get_magic_quotes_gpc()) {
// undo the damage
$m = str_replace('\\\\','\\',$m);
$m = str_replace('\"','"',$m);
$m = str_replace('\\\'','\'',$m);
}
return $m;
}
///////////////////////////////////////// DEFINITIONS
$remote = $_SERVER["REMOTE_ADDR"];
if (!empty($ACCEPTIP))
if ($remote != '127.0.0.1' && $remote != $ACCEPTIP)
err("Unauthorised client: '$remote'");
if (empty($_REQUEST['sql'])) err('No SQL');
$conn = &ADONewConnection($driver);
if (!$conn->Connect($host,$uid,$pwd,$database)) err($conn->ErrorNo(). $sep . $conn->ErrorMsg());
$sql = undomq($_REQUEST['sql']);
if (isset($_REQUEST['fetch']))
$ADODB_FETCH_MODE = $_REQUEST['fetch'];
if (isset($_REQUEST['nrows'])) {
$nrows = $_REQUEST['nrows'];
$offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : -1;
$rs = $conn->SelectLimit($sql,$nrows,$offset);
} else
$rs = $conn->Execute($sql);
if ($rs){
//$rs->timeToLive = 1;
echo _rs2serialize($rs,$conn,$sql);
$rs->Close();
} else
err($conn->ErrorNo(). $sep .$conn->ErrorMsg());
?>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+1 -1
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
+3 -3
View File
@@ -2,7 +2,7 @@
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
Contributed by Ross Smith ([email protected]).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@@ -579,7 +579,7 @@ class ADODB_Session {
$qkey = $conn->quote($key);
$binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
$sql = "SELECT $data FROM $table WHERE $binary sesskey = $qkey AND expiry >= " . time();
$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... :(
*/
@@ -901,7 +901,7 @@ class ADODB_Session {
}
ADODB_Session::_init();
register_shutdown_function('session_write_close');
// for backwards compatability only
function adodb_sess_open($save_path, $session_name, $persist = true) {
+160 -63
View File
@@ -1,64 +1,161 @@
<?php
// Session Encryption by Ari Kuorikoski <[email protected]>
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 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 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);
}
$randomPassword .= chr($randnumber);
}
return $randomPassword;
}
}
<?php
// Session Encryption by Ari Kuorikoski <[email protected]>
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 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 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);
}
$randomPassword .= chr($randnumber);
}
return $randomPassword;
}
}
class SHA1Crypt{
function keyED($txt,$encrypt_key)
{
$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;
}
function Encrypt($txt,$key)
{
srand((double)microtime()*1000000);
$encrypt_key = sha1(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++){
$sha1 = substr($txt,$i,1);
$i++;
$tmp.= (substr($txt,$i,1) ^ $sha1);
}
return $tmp;
}
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);
}
$randomPassword .= chr($randnumber);
}
return $randomPassword;
}
}
?>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
/**
* @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
V4.66 28 Sept 2005 (c) 2000-2005 John Lim ([email protected]). All rights reserved.
V4.71 24 Jan 2006 (c) 2000-2006 John Lim ([email protected]). All rights reserved.
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.