action) { case 'find': $title = $this->lang['strfind']; $body_text = $this->doFind(); break; case 'sql': default: $title = $this->lang['strsql']; $body_text = $this->doDefault(); break; } $this->setWindowName('sqledit'); $this->scripts = ''; $this->printHeader($title, $this->scripts, true, 'header_sqledit.twig'); $this->printBody(true, 'sql_edit'); echo $body_text; $this->printFooter(true, 'footer_sqledit.twig'); } /** * Allow execution of arbitrary SQL statements on a database. */ public function doDefault() { $data = $this->misc->getDatabaseAccessor(); if (!isset($_SESSION['sqlquery'])) { $_SESSION['sqlquery'] = ''; } $this->coalesceArr($_REQUEST, 'search_path', implode(',', $data->getSearchPath())); $search_path = htmlspecialchars($_REQUEST['search_path']); $sqlquery = htmlspecialchars($_SESSION['sqlquery']); $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'sql', false); $default_html .= '
'; $default_html .= PHP_EOL; // Default focus //$this->setFocus('forms[0].query'); return $default_html; } private function _getFilters() { $filters = [ 'SCHEMA' => ['langkey' => 'strschemas', 'selected' => ''], 'TABLE' => ['langkey' => 'strtables', 'selected' => ''], 'VIEW' => ['langkey' => 'strviews', 'selected' => ''], 'SEQUENCE' => ['langkey' => 'strsequences', 'selected' => ''], 'COLUMN' => ['langkey' => 'strcolumns', 'selected' => ''], 'RULE' => ['langkey' => 'strrules', 'selected' => ''], 'INDEX' => ['langkey' => 'strindexes', 'selected' => ''], 'TRIGGER' => ['langkey' => 'strtriggers', 'selected' => ''], 'CONSTRAINT' => ['langkey' => 'strconstraints', 'selected' => ''], 'FUNCTION' => ['langkey' => 'strfunctions', 'selected' => ''], 'DOMAIN' => ['langkey' => 'strdomains', 'selected' => ''], ]; return $filters; } private function _getAdvancedFilters() { $advanced_filters = [ 'AGGREGATE' => ['langkey' => 'straggregates', 'selected' => ''], 'TYPE' => ['langkey' => 'strtypes', 'selected' => ''], 'OPERATOR' => ['langkey' => 'stroperators', 'selected' => ''], 'OPCLASS' => ['langkey' => 'stropclasses', 'selected' => ''], 'CONVERSION' => ['langkey' => 'strconversions', 'selected' => ''], 'LANGUAGE' => ['langkey' => 'strlanguages', 'selected' => ''], ]; return $advanced_filters; } /** * Searches for a named database object. */ public function doFind() { $data = $this->misc->getDatabaseAccessor(); $this->coalesceArr($_REQUEST, 'term', ''); $this->coalesceArr($_REQUEST, 'filter', ''); $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'find', false); $default_html .= ''.PHP_EOL; // Default focus $this->setFocus('forms[0].term'); return $default_html; } }