@@ -58,14 +58,12 @@ public function __construct(
5858
5959 public function __invoke (ServerRequest $ request ): void
6060 {
61- $ GLOBALS ['num_fields ' ] = $ GLOBALS ['num_fields ' ] ?? null ;
62- $ GLOBALS ['result ' ] = $ GLOBALS ['result ' ] ?? null ;
6361 $ this ->checkParameters (['db ' ]);
6462
6563 $ cfg = $ this ->config ->settings ;
6664
6765 /* Check if database name is empty */
68- if (strlen ( $ GLOBALS ['db ' ]) === 0 ) {
66+ if ($ GLOBALS ['db ' ] === '' ) {
6967 Generator::mysqlDie (
7068 __ ('The database name is empty! ' ),
7169 '' ,
@@ -98,7 +96,7 @@ public function __invoke(ServerRequest $request): void
9896
9997 $ createAddField = new CreateAddField ($ this ->dbi );
10098
101- $ GLOBALS [ ' num_fields ' ] = $ createAddField ->getNumberOfFieldsFromRequest ();
99+ $ numFields = $ createAddField ->getNumberOfFieldsFromRequest ();
102100
103101 /**
104102 * The form used to define the structure of the table has been submitted
@@ -120,9 +118,9 @@ public function __invoke(ServerRequest $request): void
120118 }
121119
122120 // Executes the query
123- $ GLOBALS [ ' result ' ] = $ this ->dbi ->tryQuery ($ GLOBALS ['sql_query ' ]);
121+ $ result = $ this ->dbi ->tryQuery ($ GLOBALS ['sql_query ' ]);
124122
125- if ($ GLOBALS [ ' result ' ] ) {
123+ if ($ result ) {
126124 // Update comment table for mime types [MIME]
127125 if (isset ($ _POST ['field_mimetype ' ]) && is_array ($ _POST ['field_mimetype ' ]) && $ cfg ['BrowseMIME ' ]) {
128126 foreach ($ _POST ['field_mimetype ' ] as $ fieldindex => $ mimetype ) {
@@ -158,9 +156,9 @@ public function __invoke(ServerRequest $request): void
158156
159157 $ this ->addScriptFiles (['vendor/jquery/jquery.uitablefilter.js ' , 'indexes.js ' ]);
160158
161- $ this ->checkParameters (['server ' , 'db ' , ' table ' , ' num_fields ' ]);
159+ $ this ->checkParameters (['server ' , 'db ' ]);
162160
163- $ templateData = $ this ->columnsDefinition ->displayForm ('/table/create ' , $ GLOBALS [ ' num_fields ' ] );
161+ $ templateData = $ this ->columnsDefinition ->displayForm ('/table/create ' , $ numFields );
164162
165163 $ this ->render ('columns_definitions/column_definitions_form ' , $ templateData );
166164 }
0 commit comments