Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorffflabs <amenadiel@gmail.com>2020-10-19 20:56:55 +0300
committerffflabs <amenadiel@gmail.com>2020-10-19 20:56:55 +0300
commitf5a3f8abf2e8732321cdbc74969142ab386240f6 (patch)
tree5ab0f31210498db32207f54e3d2798c0ea9d6355
parentcbef8ed6ebf6956833a437926c8a0b2494c16343 (diff)
restores table insertion and creration
-rw-r--r--src/controllers/TablesController.php30
-rw-r--r--src/database/databasetraits/TableTrait.php5
2 files changed, 28 insertions, 7 deletions
diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php
index 36cc53d3..f72a9eac 100644
--- a/src/controllers/TablesController.php
+++ b/src/controllers/TablesController.php
@@ -171,14 +171,34 @@ class TablesController extends BaseController
];
$navlinks = [
'create' => [
- 'attr' => $attr,
+ 'attr' => [
+ 'href' => [
+ 'url' => 'tables',
+ 'urlvars' => [
+ 'action' => 'create',
+ 'server' => $this->getRequestParam('server'),
+ 'database' => $this->getRequestParam('database'),
+ 'schema' => $this->getRequestParam('schema'),
+ ],
+ ],
+ ],
'content' => $this->lang['strcreatetable'],
],
];
if ((0 < $tables->recordCount()) && $data->hasCreateTableLike()) {
$navlinks['createlike'] = [
- 'attr' => $attr,
+ 'attr' => [
+ 'href' => [
+ 'url' => 'tables',
+ 'urlvars' => [
+ 'action' => 'createlike',
+ 'server' => $this->getRequestParam('server'),
+ 'database' => $this->getRequestParam('database'),
+ 'schema' => $this->getRequestParam('schema'),
+ ],
+ ],
+ ],
'content' => $this->lang['strcreatetablelike'],
];
}
@@ -343,7 +363,7 @@ class TablesController extends BaseController
break;
case 2:
// Check inputs
- $fields = \trim($_REQUEST['fields']);
+ $fields = (int) (\trim($_REQUEST['fields']));
if ('' === \trim($_REQUEST['name'])) {
$_REQUEST['stage'] = 1;
@@ -489,7 +509,7 @@ class TablesController extends BaseController
$this->coalesceArr($_REQUEST, 'spcname', null);
// Check inputs
- $fields = \trim($_REQUEST['fields']);
+ $fields = (int) (\trim($_REQUEST['fields']));
if ('' === \trim($_REQUEST['name'])) {
$_REQUEST['stage'] = 1;
@@ -971,7 +991,7 @@ class TablesController extends BaseController
$_POST['fields'] = \unserialize(\htmlspecialchars_decode($_POST['fields'], \ENT_QUOTES));
- if ($_SESSION['counter']++ === $_POST['protection_counter']) {
+ if ($_SESSION['counter']++ === (int) ($_POST['protection_counter'])) {
$status = $data->insertRow($_POST['table'], $_POST['fields'], $_POST['values'], $_POST['nulls'], $_POST['format'], $_POST['types']);
if (0 === $status) {
diff --git a/src/database/databasetraits/TableTrait.php b/src/database/databasetraits/TableTrait.php
index eeb09bf2..55ed0974 100644
--- a/src/database/databasetraits/TableTrait.php
+++ b/src/database/databasetraits/TableTrait.php
@@ -602,7 +602,7 @@ trait TableTrait
$qual = \mb_substr($type[$i], 9);
$sql .= "\"{$field[$i]}\" timestamp";
- if ('' !== $length[$i]) {
+ if ('' !== $length[$i] ?? '') {
$sql .= "({$length[$i]})";
}
@@ -623,9 +623,10 @@ trait TableTrait
break;
default:
+ $length[$i] = $length[$i] ?? null;
$sql .= "\"{$field[$i]}\" {$type[$i]}";
- if ('' !== $length[$i]) {
+ if ('' !== $length[$i] && null !== $length[$i]) {
$sql .= "({$length[$i]})";
}
}