mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-18 20:37:55 +00:00
Fix phpPgAdmin for PHP 8.0 and PHP 8.1
This commit is contained in:
parent
20931a7d97
commit
2dfb908fbf
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved.
|
V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
Set tabs to 4.
|
Set tabs to 4.
|
||||||
|
|
||||||
Postgres7 support.
|
Postgres7 support.
|
||||||
28 Feb 2001: Currently indicate that we support LIMIT
|
28 Feb 2001: Currently indicate that we support LIMIT
|
||||||
01 Dec 2001: dannym added support for default values
|
01 Dec 2001: dannym added support for default values
|
||||||
@ -17,24 +17,24 @@ if (!defined('ADODB_DIR')) die();
|
|||||||
include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php");
|
include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php");
|
||||||
|
|
||||||
class ADODB_postgres7 extends ADODB_postgres64 {
|
class ADODB_postgres7 extends ADODB_postgres64 {
|
||||||
var $databaseType = 'postgres7';
|
var $databaseType = 'postgres7';
|
||||||
var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10
|
var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10
|
||||||
var $ansiOuter = true;
|
var $ansiOuter = true;
|
||||||
var $charSet = true; //set to true for Postgres 7 and above - PG client supports encodings
|
var $charSet = true; //set to true for Postgres 7 and above - PG client supports encodings
|
||||||
|
|
||||||
function ADODB_postgres7()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->ADODB_postgres64();
|
parent::__construct();
|
||||||
if (ADODB_ASSOC_CASE !== 2) {
|
if (ADODB_ASSOC_CASE !== 2) {
|
||||||
$this->rsPrefix .= 'assoc_';
|
$this->rsPrefix .= 'assoc_';
|
||||||
}
|
}
|
||||||
$this->_bindInputArray = PHP_VERSION >= 5.1;
|
$this->_bindInputArray = PHP_VERSION >= 5.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// the following should be compat with postgresql 7.2,
|
// the following should be compat with postgresql 7.2,
|
||||||
// which makes obsolete the LIMIT limit,offset syntax
|
// which makes obsolete the LIMIT limit,offset syntax
|
||||||
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
||||||
{
|
{
|
||||||
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
|
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
|
||||||
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
|
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
|
||||||
@ -42,7 +42,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||||
else
|
else
|
||||||
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||||
|
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -58,7 +58,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
I discovered that the MetaForeignKeys method no longer worked for Postgres 8.3.
|
I discovered that the MetaForeignKeys method no longer worked for Postgres 8.3.
|
||||||
I went ahead and modified it to work for both 8.2 and 8.3.
|
I went ahead and modified it to work for both 8.2 and 8.3.
|
||||||
Please feel free to include this change in your next release of adodb.
|
Please feel free to include this change in your next release of adodb.
|
||||||
William Kolodny [William.Kolodny#gt-t.net]
|
William Kolodny [William.Kolodny#gt-t.net]
|
||||||
*/
|
*/
|
||||||
@ -68,15 +68,15 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field,
|
SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field,
|
||||||
fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field
|
fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field
|
||||||
FROM (
|
FROM (
|
||||||
SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf,
|
SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf,
|
||||||
split_part(fee.consrc, '('::text, 3) AS rf
|
split_part(fee.consrc, '('::text, 3) AS rf
|
||||||
FROM (
|
FROM (
|
||||||
SELECT foo.relname AS ltable, foo.ftblname,
|
SELECT foo.relname AS ltable, foo.ftblname,
|
||||||
pg_get_constraintdef(foo.oid) AS consrc
|
pg_get_constraintdef(foo.oid) AS consrc
|
||||||
FROM (
|
FROM (
|
||||||
SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname
|
SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname
|
||||||
FROM pg_constraint c
|
FROM pg_constraint c
|
||||||
JOIN pg_class t ON (t.oid = c.conrelid)
|
JOIN pg_class t ON (t.oid = c.conrelid)
|
||||||
JOIN pg_class ft ON (ft.oid = c.confrelid)
|
JOIN pg_class ft ON (ft.oid = c.confrelid)
|
||||||
JOIN pg_namespace nft ON (nft.oid = ft.relnamespace)
|
JOIN pg_namespace nft ON (nft.oid = ft.relnamespace)
|
||||||
LEFT JOIN pg_description ds ON (ds.objoid = c.oid)
|
LEFT JOIN pg_description ds ON (ds.objoid = c.oid)
|
||||||
@ -89,9 +89,9 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1)
|
ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1)
|
||||||
";
|
";
|
||||||
$rs = $this->Execute($sql);
|
$rs = $this->Execute($sql);
|
||||||
|
|
||||||
if (!$rs || $rs->EOF) return false;
|
if (!$rs || $rs->EOF) return false;
|
||||||
|
|
||||||
$a = array();
|
$a = array();
|
||||||
while (!$rs->EOF) {
|
while (!$rs->EOF) {
|
||||||
if ($upper) {
|
if ($upper) {
|
||||||
@ -101,11 +101,11 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
}
|
}
|
||||||
$rs->MoveNext();
|
$rs->MoveNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $a;
|
return $a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// from Edward Jaramilla, improved version - works on pg 7.4
|
// from Edward Jaramilla, improved version - works on pg 7.4
|
||||||
function _old_MetaForeignKeys($table, $owner=false, $upper=false)
|
function _old_MetaForeignKeys($table, $owner=false, $upper=false)
|
||||||
{
|
{
|
||||||
@ -120,20 +120,20 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
c.relname = \''.strtolower($table).'\'
|
c.relname = \''.strtolower($table).'\'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
t.tgrelid';
|
t.tgrelid';
|
||||||
|
|
||||||
$rs = $this->Execute($sql);
|
$rs = $this->Execute($sql);
|
||||||
|
|
||||||
if (!$rs || $rs->EOF) return false;
|
if (!$rs || $rs->EOF) return false;
|
||||||
|
|
||||||
$arr = $rs->GetArray();
|
$arr = $rs->GetArray();
|
||||||
$a = array();
|
$a = array();
|
||||||
foreach($arr as $v) {
|
foreach($arr as $v) {
|
||||||
$data = explode(chr(0), $v['args']);
|
$data = explode(chr(0), $v['args']);
|
||||||
$size = count($data)-1; //-1 because the last node is empty
|
$size = count($data)-1; //-1 because the last node is empty
|
||||||
for($i = 4; $i < $size; $i++) {
|
for($i = 4; $i < $size; $i++) {
|
||||||
if ($upper)
|
if ($upper)
|
||||||
$a[strtoupper($data[2])][] = strtoupper($data[$i].'='.$data[++$i]);
|
$a[strtoupper($data[2])][] = strtoupper($data[$i].'='.$data[++$i]);
|
||||||
else
|
else
|
||||||
$a[$data[2]][] = $data[$i].'='.$data[++$i];
|
$a[$data[2]][] = $data[$i].'='.$data[++$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
else $sql .= $v.' $'.$i;
|
else $sql .= $v.' $'.$i;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rez = pg_query_params($this->_connectionID,$sql, $inputarr);
|
$rez = pg_query_params($this->_connectionID,$sql, $inputarr);
|
||||||
} else {
|
} else {
|
||||||
$rez = pg_query($this->_connectionID,$sql);
|
$rez = pg_query($this->_connectionID,$sql);
|
||||||
@ -170,10 +170,10 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
}
|
}
|
||||||
$this->_resultid = $rez;
|
$this->_resultid = $rez;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return $rez;
|
return $rez;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a set of functions for managing client encoding - very important if the encodings
|
// 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
|
// of your database and your output target (i.e. HTML) don't match
|
||||||
//for instance, you may have UNICODE database and server it on-site as WIN1251 etc.
|
//for instance, you may have UNICODE database and server it on-site as WIN1251 etc.
|
||||||
@ -191,7 +191,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
return $this->charSet;
|
return $this->charSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCharSet - switch the client encoding
|
// SetCharSet - switch the client encoding
|
||||||
function SetCharSet($charset_name)
|
function SetCharSet($charset_name)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------------
|
||||||
Class Name: Recordset
|
Class Name: Recordset
|
||||||
--------------------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------------------*/
|
||||||
@ -213,21 +213,21 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
|||||||
class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
||||||
|
|
||||||
var $databaseType = "postgres7";
|
var $databaseType = "postgres7";
|
||||||
|
|
||||||
|
|
||||||
function __construct($queryID,$mode=false)
|
function __construct($queryID,$mode=false)
|
||||||
{
|
{
|
||||||
parent::__construct($queryID,$mode);
|
parent::__construct($queryID,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 10% speedup to move MoveNext to child class
|
// 10% speedup to move MoveNext to child class
|
||||||
function MoveNext()
|
function MoveNext()
|
||||||
{
|
{
|
||||||
if (!$this->EOF) {
|
if (!$this->EOF) {
|
||||||
$this->_currentRow++;
|
$this->_currentRow++;
|
||||||
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
||||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||||
|
|
||||||
if (is_array($this->fields)) {
|
if (is_array($this->fields)) {
|
||||||
if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
|
if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
|
||||||
return true;
|
return true;
|
||||||
@ -237,43 +237,43 @@ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
|||||||
$this->EOF = true;
|
$this->EOF = true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
|
class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
|
||||||
|
|
||||||
var $databaseType = "postgres7";
|
var $databaseType = "postgres7";
|
||||||
|
|
||||||
|
|
||||||
function ADORecordSet_assoc_postgres7($queryID,$mode=false)
|
function ADORecordSet_assoc_postgres7($queryID,$mode=false)
|
||||||
{
|
{
|
||||||
$this->ADORecordSet_postgres64($queryID,$mode);
|
$this->ADORecordSet_postgres64($queryID,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _fetch()
|
function _fetch()
|
||||||
{
|
{
|
||||||
if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0)
|
if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||||
|
|
||||||
if ($this->fields) {
|
if ($this->fields) {
|
||||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||||
$this->_updatefields();
|
$this->_updatefields();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (is_array($this->fields));
|
return (is_array($this->fields));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create associative array
|
// Create associative array
|
||||||
function _updatefields()
|
function _updatefields()
|
||||||
{
|
{
|
||||||
if (ADODB_ASSOC_CASE == 2) return; // native
|
if (ADODB_ASSOC_CASE == 2) return; // native
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$lowercase = (ADODB_ASSOC_CASE == 0);
|
$lowercase = (ADODB_ASSOC_CASE == 0);
|
||||||
|
|
||||||
foreach($this->fields as $k => $v) {
|
foreach($this->fields as $k => $v) {
|
||||||
if (is_integer($k)) $arr[$k] = $v;
|
if (is_integer($k)) $arr[$k] = $v;
|
||||||
else {
|
else {
|
||||||
@ -285,25 +285,25 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
|
|||||||
}
|
}
|
||||||
$this->fields = $arr;
|
$this->fields = $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MoveNext()
|
function MoveNext()
|
||||||
{
|
{
|
||||||
if (!$this->EOF) {
|
if (!$this->EOF) {
|
||||||
$this->_currentRow++;
|
$this->_currentRow++;
|
||||||
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
||||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||||
|
|
||||||
if (is_array($this->fields)) {
|
if (is_array($this->fields)) {
|
||||||
if ($this->fields) {
|
if ($this->fields) {
|
||||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||||
|
|
||||||
$this->_updatefields();
|
$this->_updatefields();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->fields = false;
|
$this->fields = false;
|
||||||
$this->EOF = true;
|
$this->EOF = true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
|
|||||||
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
||||||
|
|
||||||
RETRIES=10
|
RETRIES=10
|
||||||
DISABLED_VERSIONS=("8.0" "8.1")
|
DISABLED_VERSIONS=()
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -230,6 +230,20 @@ phpPgAdmin requires some adjustments to work with the Devilbox intranet. See bel
|
|||||||
+ session_start();
|
+ session_start();
|
||||||
+ }
|
+ }
|
||||||
```
|
```
|
||||||
|
`libraries/adodb/drivers/adodb-postgres64.inc.php`
|
||||||
|
```diff
|
||||||
|
- function ADODB_postgres64()
|
||||||
|
+ function __construct()
|
||||||
|
```
|
||||||
|
|
||||||
|
`libraries/adodb/drivers/adodb-postgres7.inc.php`
|
||||||
|
```diff
|
||||||
|
- function ADODB_postgres7()
|
||||||
|
+ public function __construct()
|
||||||
|
{
|
||||||
|
- $this->ADODB_postgres64();
|
||||||
|
+ parent::__construct();
|
||||||
|
```
|
||||||
|
|
||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user