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
|
||||
/*
|
||||
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.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
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.
|
||||
|
||||
|
||||
Postgres7 support.
|
||||
28 Feb 2001: Currently indicate that we support LIMIT
|
||||
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");
|
||||
|
||||
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 $ansiOuter = true;
|
||||
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) {
|
||||
$this->rsPrefix .= 'assoc_';
|
||||
}
|
||||
$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
|
||||
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) : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
|
||||
@ -42,7 +42,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
else
|
||||
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
|
||||
|
||||
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 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.
|
||||
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,
|
||||
fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field
|
||||
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
|
||||
FROM (
|
||||
SELECT foo.relname AS ltable, foo.ftblname,
|
||||
pg_get_constraintdef(foo.oid) AS consrc
|
||||
FROM (
|
||||
SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname
|
||||
FROM pg_constraint c
|
||||
JOIN pg_class t ON (t.oid = c.conrelid)
|
||||
FROM pg_constraint c
|
||||
JOIN pg_class t ON (t.oid = c.conrelid)
|
||||
JOIN pg_class ft ON (ft.oid = c.confrelid)
|
||||
JOIN pg_namespace nft ON (nft.oid = ft.relnamespace)
|
||||
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)
|
||||
";
|
||||
$rs = $this->Execute($sql);
|
||||
|
||||
|
||||
if (!$rs || $rs->EOF) return false;
|
||||
|
||||
|
||||
$a = array();
|
||||
while (!$rs->EOF) {
|
||||
if ($upper) {
|
||||
@ -101,11 +101,11 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
}
|
||||
$rs->MoveNext();
|
||||
}
|
||||
|
||||
|
||||
return $a;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// from Edward Jaramilla, improved version - works on pg 7.4
|
||||
function _old_MetaForeignKeys($table, $owner=false, $upper=false)
|
||||
{
|
||||
@ -120,20 +120,20 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
c.relname = \''.strtolower($table).'\'
|
||||
ORDER BY
|
||||
t.tgrelid';
|
||||
|
||||
|
||||
$rs = $this->Execute($sql);
|
||||
|
||||
|
||||
if (!$rs || $rs->EOF) return false;
|
||||
|
||||
|
||||
$arr = $rs->GetArray();
|
||||
$a = array();
|
||||
foreach($arr as $v) {
|
||||
$data = explode(chr(0), $v['args']);
|
||||
$size = count($data)-1; //-1 because the last node is empty
|
||||
for($i = 4; $i < $size; $i++) {
|
||||
if ($upper)
|
||||
if ($upper)
|
||||
$a[strtoupper($data[2])][] = strtoupper($data[$i].'='.$data[++$i]);
|
||||
else
|
||||
else
|
||||
$a[$data[2]][] = $data[$i].'='.$data[++$i];
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
else $sql .= $v.' $'.$i;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$rez = pg_query_params($this->_connectionID,$sql, $inputarr);
|
||||
} else {
|
||||
$rez = pg_query($this->_connectionID,$sql);
|
||||
@ -170,10 +170,10 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
}
|
||||
$this->_resultid = $rez;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return $rez;
|
||||
}
|
||||
|
||||
|
||||
// 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 UNICODE database and server it on-site as WIN1251 etc.
|
||||
@ -191,7 +191,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
return $this->charSet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SetCharSet - switch the client encoding
|
||||
function SetCharSet($charset_name)
|
||||
{
|
||||
@ -205,7 +205,7 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------------------
|
||||
Class Name: Recordset
|
||||
--------------------------------------------------------------------------------------*/
|
||||
@ -213,21 +213,21 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
||||
|
||||
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
|
||||
function MoveNext()
|
||||
function MoveNext()
|
||||
{
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow++;
|
||||
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||
|
||||
|
||||
if (is_array($this->fields)) {
|
||||
if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
|
||||
return true;
|
||||
@ -237,43 +237,43 @@ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
||||
$this->EOF = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
|
||||
|
||||
var $databaseType = "postgres7";
|
||||
|
||||
|
||||
function ADORecordSet_assoc_postgres7($queryID,$mode=false)
|
||||
|
||||
|
||||
function ADORecordSet_assoc_postgres7($queryID,$mode=false)
|
||||
{
|
||||
$this->ADORecordSet_postgres64($queryID,$mode);
|
||||
}
|
||||
|
||||
|
||||
function _fetch()
|
||||
{
|
||||
if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0)
|
||||
return false;
|
||||
|
||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||
|
||||
|
||||
if ($this->fields) {
|
||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||
$this->_updatefields();
|
||||
}
|
||||
|
||||
|
||||
return (is_array($this->fields));
|
||||
}
|
||||
|
||||
|
||||
// Create associative array
|
||||
function _updatefields()
|
||||
{
|
||||
if (ADODB_ASSOC_CASE == 2) return; // native
|
||||
|
||||
|
||||
$arr = array();
|
||||
$lowercase = (ADODB_ASSOC_CASE == 0);
|
||||
|
||||
|
||||
foreach($this->fields as $k => $v) {
|
||||
if (is_integer($k)) $arr[$k] = $v;
|
||||
else {
|
||||
@ -285,25 +285,25 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
|
||||
}
|
||||
$this->fields = $arr;
|
||||
}
|
||||
|
||||
function MoveNext()
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow++;
|
||||
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||
|
||||
|
||||
if (is_array($this->fields)) {
|
||||
if ($this->fields) {
|
||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||
|
||||
|
||||
$this->_updatefields();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->fields = false;
|
||||
$this->EOF = true;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
|
||||
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
||||
|
||||
RETRIES=10
|
||||
DISABLED_VERSIONS=("8.0" "8.1")
|
||||
DISABLED_VERSIONS=()
|
||||
|
||||
|
||||
echo
|
||||
|
@ -230,6 +230,20 @@ phpPgAdmin requires some adjustments to work with the Devilbox intranet. See bel
|
||||
+ 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user