diff options
author | Kamil Tekiela <tekiela246@gmail.com> | 2022-08-17 20:27:37 +0300 |
---|---|---|
committer | Kamil Tekiela <tekiela246@gmail.com> | 2022-08-17 22:31:51 +0300 |
commit | 2e126d7f6563a2ac5eb3a2eaf367d3ead5096f87 (patch) | |
tree | 7ca9a63905bf23a6c237a07622ee1773cb0ce007 /libraries/classes/Controllers | |
parent | de1eb66dbfa1647617a56c8aa1e97f41bd220b36 (diff) |
Fix table creation
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
Diffstat (limited to 'libraries/classes/Controllers')
-rw-r--r-- | libraries/classes/Controllers/Table/CreateController.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libraries/classes/Controllers/Table/CreateController.php b/libraries/classes/Controllers/Table/CreateController.php index 68ec6f0ed2..4edd0b565a 100644 --- a/libraries/classes/Controllers/Table/CreateController.php +++ b/libraries/classes/Controllers/Table/CreateController.php @@ -58,14 +58,12 @@ class CreateController extends AbstractController public function __invoke(ServerRequest $request): void { - $GLOBALS['num_fields'] = $GLOBALS['num_fields'] ?? null; - $GLOBALS['result'] = $GLOBALS['result'] ?? null; $this->checkParameters(['db']); $cfg = $this->config->settings; /* Check if database name is empty */ - if (strlen($GLOBALS['db']) === 0) { + if ($GLOBALS['db'] === '') { Generator::mysqlDie( __('The database name is empty!'), '', @@ -98,7 +96,7 @@ class CreateController extends AbstractController $createAddField = new CreateAddField($this->dbi); - $GLOBALS['num_fields'] = $createAddField->getNumberOfFieldsFromRequest(); + $numFields = $createAddField->getNumberOfFieldsFromRequest(); /** * The form used to define the structure of the table has been submitted @@ -120,9 +118,9 @@ class CreateController extends AbstractController } // Executes the query - $GLOBALS['result'] = $this->dbi->tryQuery($GLOBALS['sql_query']); + $result = $this->dbi->tryQuery($GLOBALS['sql_query']); - if ($GLOBALS['result']) { + if ($result) { // Update comment table for mime types [MIME] if (isset($_POST['field_mimetype']) && is_array($_POST['field_mimetype']) && $cfg['BrowseMIME']) { foreach ($_POST['field_mimetype'] as $fieldindex => $mimetype) { @@ -158,9 +156,9 @@ class CreateController extends AbstractController $this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js', 'indexes.js']); - $this->checkParameters(['server', 'db', 'table', 'num_fields']); + $this->checkParameters(['server', 'db']); - $templateData = $this->columnsDefinition->displayForm('/table/create', $GLOBALS['num_fields']); + $templateData = $this->columnsDefinition->displayForm('/table/create', $numFields); $this->render('columns_definitions/column_definitions_form', $templateData); } |