mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 14:46:36 +02:00
Ensure PHP 5.3 compatibility
This commit is contained in:
@@ -83,17 +83,18 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
|
||||
$partitioning = "";
|
||||
if (support("partitioning")) {
|
||||
if (isset($partition_by[$row["partition_by"]])) {
|
||||
$params = array_filter($row, function ($key) {
|
||||
return preg_match('~^partition~', $key);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
$params = array();
|
||||
foreach ($row as $key => $val) {
|
||||
if (preg_match('~^partition~', $key)) {
|
||||
$params[$key] = $val;
|
||||
}
|
||||
}
|
||||
foreach ($params["partition_names"] as $key => $name) {
|
||||
if ($name == "") {
|
||||
unset($params["partition_names"][$key]);
|
||||
unset($params["partition_values"][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($params != get_partitions_info($TABLE)) {
|
||||
$partitions = array();
|
||||
if ($params["partition_by"] == 'RANGE' || $params["partition_by"] == 'LIST') {
|
||||
@@ -102,7 +103,6 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
|
||||
$partitions[] = "\n PARTITION " . idf_escape($name) . " VALUES " . ($params["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
|
||||
}
|
||||
}
|
||||
|
||||
// $params["partition"] can be expression, not only column
|
||||
$partitioning .= "\nPARTITION BY $params[partition_by]($params[partition])";
|
||||
if ($partitions) {
|
||||
|
@@ -43,7 +43,10 @@ if (isset($_GET["pgsql"])) {
|
||||
}
|
||||
|
||||
function quote($string) {
|
||||
return pg_escape_literal($this->link, $string);
|
||||
return (function_exists('pg_escape_literal')
|
||||
? pg_escape_literal($this->link, $string) // available since PHP 5.4.4
|
||||
: "'" . pg_escape_string($this->link, $string) . "'"
|
||||
);
|
||||
}
|
||||
|
||||
function value($val, $field) {
|
||||
|
@@ -78,7 +78,7 @@ if (isset($_GET["sqlite"])) {
|
||||
);
|
||||
}
|
||||
|
||||
function __desctruct() {
|
||||
function __destruct() {
|
||||
return $this->result->finalize();
|
||||
}
|
||||
}
|
||||
|
@@ -62,7 +62,6 @@ if (function_exists("get_magic_quotes_runtime") && get_magic_quotes_runtime()) {
|
||||
set_magic_quotes_runtime(false);
|
||||
}
|
||||
@set_time_limit(0); // @ - can be disabled
|
||||
@ini_set("zend.ze1_compatibility_mode", false); // @ - deprecated
|
||||
@ini_set("precision", 15); // @ - can be disabled, 15 - internal PHP precision
|
||||
|
||||
include "../adminer/include/lang.inc.php";
|
||||
|
@@ -108,4 +108,11 @@
|
||||
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing"/>
|
||||
|
||||
<!--
|
||||
This is slow and has false positives but it's useful occasionally.
|
||||
https://github.com/PHPCompatibility/PHPCompatibility
|
||||
<rule ref="PHPCompatibility"/>
|
||||
<config name="testVersion" value="5.3-"/>
|
||||
-->
|
||||
</ruleset>
|
||||
|
@@ -422,7 +422,7 @@ if (isset($_GET["simpledb"])) {
|
||||
'max_redirects' => 0,
|
||||
))));
|
||||
if (!$file) {
|
||||
$this->error = lang('Invalid credentials.');
|
||||
$connection->error = lang('Invalid credentials.');
|
||||
return false;
|
||||
}
|
||||
libxml_use_internal_errors(true);
|
||||
|
Reference in New Issue
Block a user