sqlQueryForm = $sqlQueryForm; } public function __invoke(ServerRequest $request): void { $GLOBALS['goto'] = $GLOBALS['goto'] ?? null; $GLOBALS['back'] = $GLOBALS['back'] ?? null; $GLOBALS['errorUrl'] = $GLOBALS['errorUrl'] ?? null; $this->addScriptFiles(['makegrid.js', 'vendor/jquery/jquery.uitablefilter.js', 'sql.js']); $pageSettings = new PageSettings('Sql'); $this->response->addHTML($pageSettings->getErrorHTML()); $this->response->addHTML($pageSettings->getHTML()); $this->checkParameters(['db']); $GLOBALS['errorUrl'] = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database'); $GLOBALS['errorUrl'] .= Url::getCommon(['db' => $GLOBALS['db']], '&'); if (! $this->hasDatabase()) { return; } /** * After a syntax error, we return to this script * with the typed query in the textarea. */ $GLOBALS['goto'] = Url::getFromRoute('/database/sql'); $GLOBALS['back'] = $GLOBALS['goto']; $delimiter = $request->getParsedBodyParam('delimiter'); $this->response->addHTML($this->sqlQueryForm->getHtml( $GLOBALS['db'], '', true, false, $delimiter !== null ? htmlspecialchars($delimiter) : ';' )); } }