From 331c63826e1e85fd3b8ecb076ad113e859d47493 Mon Sep 17 00:00:00 2001 From: Amenadiel Date: Tue, 7 Jan 2020 15:59:58 -0300 Subject: rebase develop on top of master --- src/classes/ADONewConnection.php | 6 +- src/classes/ADORecordSet.php | 11 +- src/classes/ADOdbException.php | 5 +- src/classes/ArrayRecordSet.php | 6 +- src/classes/ContainerUtils.php | 78 +++++- src/classes/Misc.php | 75 ++---- src/classes/PluginManager.php | 4 +- src/classes/Translations.php | 2 +- src/controllers/AcinsertController.php | 4 +- src/controllers/AggregatesController.php | 4 +- src/controllers/AlldbController.php | 4 +- src/controllers/BaseController.php | 112 ++++++-- src/controllers/BrowserController.php | 4 +- src/controllers/CastsController.php | 4 +- src/controllers/ColpropertiesController.php | 4 +- src/controllers/ConstraintsController.php | 16 +- src/controllers/ConversionsController.php | 4 +- src/controllers/DatabaseController.php | 152 ++++++----- src/controllers/DataexportController.php | 4 +- src/controllers/DataimportController.php | 10 +- src/controllers/DbexportController.php | 4 +- src/controllers/DisplayController.php | 16 +- src/controllers/DomainsController.php | 4 +- src/controllers/FulltextController.php | 4 +- src/controllers/FunctionsController.php | 24 +- src/controllers/GroupsController.php | 4 +- src/controllers/HelpController.php | 4 +- src/controllers/HistoryController.php | 48 ++-- src/controllers/IndexesController.php | 4 +- src/controllers/InfoController.php | 12 +- src/controllers/IntroController.php | 4 +- src/controllers/LanguagesController.php | 4 +- src/controllers/LoginController.php | 4 +- .../MaterializedviewpropertiesController.php | 4 +- src/controllers/MaterializedviewsController.php | 4 +- src/controllers/OpclassesController.php | 4 +- src/controllers/OperatorsController.php | 4 +- src/controllers/PrivilegesController.php | 6 +- src/controllers/RolesController.php | 4 +- src/controllers/RulesController.php | 4 +- src/controllers/SchemasController.php | 4 +- src/controllers/SequencesController.php | 4 +- src/controllers/ServersController.php | 4 +- src/controllers/SqlController.php | 10 +- src/controllers/SqleditController.php | 60 +++-- src/controllers/TablesController.php | 282 +++++++++++---------- src/controllers/TablespacesController.php | 4 +- src/controllers/TblpropertiesController.php | 8 +- src/controllers/TriggersController.php | 4 +- src/controllers/TypesController.php | 10 +- src/controllers/UsersController.php | 4 +- src/controllers/ViewpropertiesController.php | 4 +- src/controllers/ViewsController.php | 4 +- src/decorators/ActionUrlDecorator.php | 2 +- src/decorators/ArrayMergeDecorator.php | 2 +- src/decorators/BranchUrlDecorator.php | 2 +- src/decorators/CallbackDecorator.php | 2 +- src/decorators/ConcatDecorator.php | 2 +- src/decorators/Decorator.php | 2 +- src/decorators/FieldDecorator.php | 2 +- src/decorators/IfEmptyDecorator.php | 2 +- src/decorators/RedirectUrlDecorator.php | 2 +- src/decorators/ReplaceDecorator.php | 2 +- src/decorators/UrlDecorator.php | 2 +- src/help/PostgresDoc10.php | 2 +- src/help/PostgresDoc74.php | 2 +- src/help/PostgresDoc80.php | 2 +- src/help/PostgresDoc81.php | 2 +- src/help/PostgresDoc82.php | 2 +- src/help/PostgresDoc83.php | 2 +- src/help/PostgresDoc84.php | 2 +- src/help/PostgresDoc90.php | 2 +- src/help/PostgresDoc91.php | 2 +- src/help/PostgresDoc92.php | 2 +- src/help/PostgresDoc93.php | 2 +- src/help/PostgresDoc94.php | 2 +- src/help/PostgresDoc95.php | 2 +- src/help/PostgresDoc96.php | 2 +- src/lib.inc.php | 36 +-- src/middleware/PopulateRequestResponse.php | 7 +- src/traits/AdminTrait.php | 2 +- src/traits/ExportTrait.php | 2 +- src/traits/FormTrait.php | 2 +- src/traits/HelperTrait.php | 4 +- src/traits/InsertEditRowTrait.php | 2 +- src/traits/MiscTrait.php | 6 +- src/traits/ServersTrait.php | 2 +- src/traits/ViewsMatViewsPropertiesTrait.php | 2 +- src/traits/ViewsMatviewsTrait.php | 22 +- src/translations/Afrikaans.php | 4 +- src/translations/Arabic.php | 4 +- src/translations/Catalan.php | 4 +- src/translations/ChineseSim.php | 4 +- src/translations/ChineseTr.php | 4 +- src/translations/ChineseUtf8ZhCn.php | 4 +- src/translations/ChineseUtf8ZhTw.php | 4 +- src/translations/Czech.php | 4 +- src/translations/Danish.php | 4 +- src/translations/Dutch.php | 4 +- src/translations/English.php | 4 +- src/translations/French.php | 4 +- src/translations/Galician.php | 4 +- src/translations/German.php | 4 +- src/translations/Greek.php | 4 +- src/translations/Hebrew.php | 4 +- src/translations/Hungarian.php | 4 +- src/translations/Italian.php | 4 +- src/translations/Japanese.php | 4 +- src/translations/Lithuanian.php | 4 +- src/translations/Mongol.php | 4 +- src/translations/Polish.php | 4 +- src/translations/PortugueseBr.php | 4 +- src/translations/PortuguesePt.php | 4 +- src/translations/Romanian.php | 4 +- src/translations/Russian.php | 4 +- src/translations/RussianUtf8.php | 4 +- src/translations/Slovak.php | 4 +- src/translations/Spanish.php | 4 +- src/translations/Swedish.php | 4 +- src/translations/Turkish.php | 4 +- src/translations/Ukrainian.php | 4 +- src/xhtml/HTMLController.php | 2 +- src/xhtml/HTMLFooterController.php | 50 ++-- src/xhtml/HTMLHeaderController.php | 2 +- src/xhtml/HTMLNavbarController.php | 2 +- src/xhtml/HTMLTableController.php | 8 +- src/xhtml/TreeController.php | 86 ++----- src/xhtml/XHtmlButton.php | 2 +- src/xhtml/XHtmlElement.php | 2 +- src/xhtml/XHtmlOption.php | 2 +- src/xhtml/XHtmlSelect.php | 2 +- src/xhtml/XHtmlSimpleElement.php | 2 +- 132 files changed, 675 insertions(+), 827 deletions(-) (limited to 'src') diff --git a/src/classes/ADONewConnection.php b/src/classes/ADONewConnection.php index 19f89da4..d8308376 100644 --- a/src/classes/ADONewConnection.php +++ b/src/classes/ADONewConnection.php @@ -1,7 +1,7 @@ @@ -158,6 +157,6 @@ class ADOdbException extends \Exception //\PC::debug(['errno' => $errno, 'fn' => $fn, 'errmsg' => $errmsg], $tag); - throw new \PHPPgAdmin\ADOdbException($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); + throw new self($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); } } diff --git a/src/classes/ArrayRecordSet.php b/src/classes/ArrayRecordSet.php index 0e18e3d6..b7d61932 100644 --- a/src/classes/ArrayRecordSet.php +++ b/src/classes/ArrayRecordSet.php @@ -1,7 +1,7 @@ version; $phpMinVer = (str_replace(['<', '>', '='], '', $composerinfo->require->php)); @@ -49,14 +47,14 @@ class ContainerUtils 'base_path' => BASE_PATH, 'debug' => DEBUGMODE, - 'routerCacheFile' => BASE_PATH.'/temp/route.cache.php', + 'routerCacheFile' => BASE_PATH . '/temp/route.cache.php', // Configuration file version. If this is greater than that in config.inc.php, then // the app will refuse to run. This and $conf['version'] should be incremented whenever // backwards incompatible changes are made to config.inc.php-dist. 'base_version' => 60, // Application version - 'appVersion' => 'v'.$appVersion, + 'appVersion' => 'v' . $appVersion, // Application name 'appName' => 'phpPgAdmin6', @@ -73,7 +71,7 @@ class ContainerUtils // Fetch DI Container $container = $this->app->getContainer(); $container['utils'] = $this; - $container['version'] = 'v'.$appVersion; + $container['version'] = 'v' . $appVersion; $container['errors'] = []; $this->container = $container; @@ -88,24 +86,76 @@ class ContainerUtils return [self::$instance->container, self::$instance->app]; } + public function icon($icon) + { + + $conf = $this->container->conf; + if (is_string($icon)) { + $path = "/assets/images/themes/{$conf['theme']}/{$icon}"; + if (file_exists(\BASE_PATH . $path . '.png')) { + return SUBFOLDER . $path . '.png'; + } + + if (file_exists(\BASE_PATH . $path . '.gif')) { + return SUBFOLDER . $path . '.gif'; + } + + if (file_exists(\BASE_PATH . $path . '.ico')) { + return SUBFOLDER . $path . '.ico'; + } + + $path = "/assets/images/themes/default/{$icon}"; + if (file_exists(\BASE_PATH . $path . '.png')) { + return SUBFOLDER . $path . '.png'; + } + + if (file_exists(\BASE_PATH . $path . '.gif')) { + return SUBFOLDER . $path . '.gif'; + } + + if (file_exists(\BASE_PATH . $path . '.ico')) { + return SUBFOLDER . $path . '.ico'; + } + } else { + // Icon from plugins + $path = "/plugins/{$icon[0]}/images/{$icon[1]}"; + if (file_exists(\BASE_PATH . $path . '.png')) { + return SUBFOLDER . $path . '.png'; + } + + if (file_exists(\BASE_PATH . $path . '.gif')) { + return SUBFOLDER . $path . '.gif'; + } + + if (file_exists(\BASE_PATH . $path . '.ico')) { + return SUBFOLDER . $path . '.ico'; + } + } + + return ''; + } + public function maybeRenderIframes($response, $subject, $query_string) { $c = $this->container; $in_test = $c->view->offsetGet('in_test'); if ($in_test === '1') { - $className = '\PHPPgAdmin\Controller\\'.ucfirst($subject).'Controller'; + $className = '\PHPPgAdmin\Controller\\' . ucfirst($subject) . 'Controller'; $controller = new $className($c); return $controller->render(); } - $viewVars = [ - 'url' => '/src/views/'.$subject.($query_string ? '?'.$query_string : ''), + 'icon' => [ + 'Refresh' => $this->icon('Refresh'), + 'Servers' => $this->icon('Servers'), + ], + 'url' => '/src/views/' . $subject . ($query_string ? '?' . $query_string : ''), 'headertemplate' => 'header.twig', ]; - return $c->view->render($response, 'iframe_view.twig', $viewVars); + return $c->view->render($response, 'main.twig', $viewVars); } /** @@ -206,10 +256,10 @@ class ContainerUtils // if server_id isn't set, then you will be redirected to intro if ($this->container->requestobj->getQueryParam('server') === null) { - $destinationurl = \SUBFOLDER.'/src/views/intro'; + $destinationurl = \SUBFOLDER . '/src/views/intro'; } else { // otherwise, you'll be redirected to the login page for that server; - $destinationurl = \SUBFOLDER.'/src/views/login'.($query_string ? '?'.$query_string : ''); + $destinationurl = \SUBFOLDER . '/src/views/login' . ($query_string ? '?' . $query_string : ''); } return $destinationurl; @@ -233,7 +283,7 @@ class ContainerUtils $destinationurl = $this->getRedirectUrl(); } else { $url = $this->container->misc->getLastTabURL($subject); - $this->addFlash($url, 'getLastTabURL for '.$subject); + $this->addFlash($url, 'getLastTabURL for ' . $subject); // Load query vars into superglobal arrays if (isset($url['urlvars'])) { $urlvars = []; diff --git a/src/classes/Misc.php b/src/classes/Misc.php index c364f895..a5c5e554 100644 --- a/src/classes/Misc.php +++ b/src/classes/Misc.php @@ -1,7 +1,7 @@ conf['servers']) === 1) { $info = $this->conf['servers'][0]; - $this->_server_id = sha1($info['host'].':'.$info['port'].':'.$info['sslmode']); + $this->_server_id = sha1($info['host'] . ':' . $info['port'] . ':' . $info['sslmode']); } elseif ($request_server !== null) { $this->_server_id = $request_server; } elseif (isset($_SESSION['webdbLogin']) && count($_SESSION['webdbLogin']) > 0) { @@ -182,8 +178,8 @@ class Misc { if ($help !== null) { $helplink = $this->getHelpLink($help); - $str .= ''; - $str .= $this->lang['strhelpicon'].''; + $str .= ''; + $str .= $this->lang['strhelpicon'] . ''; } if ($do_print) { echo $str; @@ -201,7 +197,7 @@ class Misc */ public function getHelpLink($help) { - return htmlspecialchars(SUBFOLDER.'/help?help='.urlencode($help).'&server='.urlencode($this->getServerId())); + return htmlspecialchars(SUBFOLDER . '/help?help=' . urlencode($help) . '&server=' . urlencode($this->getServerId())); } /** @@ -332,7 +328,7 @@ class Misc return null; } - $_type = '\PHPPgAdmin\Database\\'.$_type; + $_type = '\PHPPgAdmin\Database\\' . $_type; $this->prtrace('driver:', $_type); @@ -454,7 +450,7 @@ class Misc // Otherwise, look for it in the conf file foreach ($this->conf['servers'] as $idx => $info) { - $server_string = $info['host'].':'.$info['port'].':'.$info['sslmode']; + $server_string = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']; $server_sha = sha1($server_string); if ($this->_server_id === $server_string || @@ -609,13 +605,13 @@ class Misc $schema = $this->container->schema || isset($_REQUEST['schema']) ? $_REQUEST['schema'] : null; if ($server && $exclude_from !== 'server') { - $href[] = 'server='.urlencode($server); + $href[] = 'server=' . urlencode($server); } if ($database && $exclude_from !== 'database') { - $href[] = 'database='.urlencode($database); + $href[] = 'database=' . urlencode($database); } if ($schema && $exclude_from !== 'schema') { - $href[] = 'schema='.urlencode($schema); + $href[] = 'schema=' . urlencode($schema); } $this->href = htmlentities(implode('&', $href)); @@ -630,14 +626,14 @@ class Misc { $form = []; if ($this->container->server) { - $form[] = ''; + $form[] = ''; } if ($this->container->database) { - $form[] = ''; + $form[] = ''; } if ($this->container->schema) { - $form[] = ''; + $form[] = ''; } $this->form = implode("\n", $form); @@ -729,49 +725,8 @@ class Misc public function icon($icon) { - if (is_string($icon)) { - $path = "/assets/images/themes/{$this->conf['theme']}/{$icon}"; - if (file_exists(\BASE_PATH.$path.'.png')) { - return SUBFOLDER.$path.'.png'; - } - - if (file_exists(\BASE_PATH.$path.'.gif')) { - return SUBFOLDER.$path.'.gif'; - } - - if (file_exists(\BASE_PATH.$path.'.ico')) { - return SUBFOLDER.$path.'.ico'; - } - - $path = "/assets/images/themes/default/{$icon}"; - if (file_exists(\BASE_PATH.$path.'.png')) { - return SUBFOLDER.$path.'.png'; - } - - if (file_exists(\BASE_PATH.$path.'.gif')) { - return SUBFOLDER.$path.'.gif'; - } - - if (file_exists(\BASE_PATH.$path.'.ico')) { - return SUBFOLDER.$path.'.ico'; - } - } else { - // Icon from plugins - $path = "/plugins/{$icon[0]}/images/{$icon[1]}"; - if (file_exists(\BASE_PATH.$path.'.png')) { - return SUBFOLDER.$path.'.png'; - } - - if (file_exists(\BASE_PATH.$path.'.gif')) { - return SUBFOLDER.$path.'.gif'; - } - - if (file_exists(\BASE_PATH.$path.'.ico')) { - return SUBFOLDER.$path.'.ico'; - } - } + return $this->container->utils->icon($icon); - return ''; } /** @@ -814,7 +769,7 @@ class Misc if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $data->fieldClean($str); - return '"'.$str.'"'; + return '"' . $str . '"'; } return escapeshellcmd($str); diff --git a/src/classes/PluginManager.php b/src/classes/PluginManager.php index 1dac7470..5bbdbcaf 100644 --- a/src/classes/PluginManager.php +++ b/src/classes/PluginManager.php @@ -1,7 +1,7 @@ '.PHP_EOL; - ++$i; + $i++; $res->moveNext(); } echo ''.PHP_EOL; diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php index 20ba4db1..e134b594 100644 --- a/src/controllers/AggregatesController.php +++ b/src/controllers/AggregatesController.php @@ -1,7 +1,7 @@ container = $container; $this->lang = $container->get('lang'); - $this->controller_name = str_replace(__NAMESPACE__.'\\', '', get_class($this)); + $this->controller_name = str_replace(__NAMESPACE__ . '\\', '', get_class($this)); $this->view_name = str_replace('controller', '', strtolower($this->controller_name)); $this->script = $this->view_name; @@ -153,7 +152,7 @@ class BaseController { $title = $title ? $title : $this->controller_title; - return $prefix.$this->lang[$title].($suffix ? ': '.$suffix : ''); + return $prefix . $this->lang[$title] . ($suffix ? ': ' . $suffix : ''); } public function getContainer() @@ -164,7 +163,11 @@ class BaseController private function _getTableController() { if (null === $this->table_controller) { - $this->table_controller = new \PHPPgAdmin\XHtml\HTMLTableController($this->getContainer(), $this->controller_name); + $this->prtrace(__METHOD__); + $this->table_controller = new \PHPPgAdmin\XHtml\HTMLTableController( + $this->getContainer(), + $this->controller_name + ); } return $this->table_controller; @@ -173,7 +176,11 @@ class BaseController private function _getFooterController() { if (null === $this->footer_controller) { - $this->footer_controller = new \PHPPgAdmin\XHtml\HTMLFooterController($this->getContainer(), $this->controller_name); + $this->prtrace(__METHOD__); + $this->footer_controller = new \PHPPgAdmin\XHtml\HTMLFooterController( + $this->getContainer(), + $this->controller_name + ); } return $this->footer_controller; @@ -182,7 +189,11 @@ class BaseController private function _getHeaderController() { if (null === $this->header_controller) { - $this->header_controller = new \PHPPgAdmin\XHtml\HTMLHeaderController($this->getContainer(), $this->controller_name); + $this->prtrace(__METHOD__); + $this->header_controller = new \PHPPgAdmin\XHtml\HTMLHeaderController( + $this->getContainer(), + $this->controller_name + ); } return $this->header_controller; @@ -191,19 +202,50 @@ class BaseController private function _getNavbarController() { if (null === $this->trail_controller) { - $this->trail_controller = new \PHPPgAdmin\XHtml\HTMLNavbarController($this->getContainer(), $this->controller_name); + $this->prtrace(__METHOD__); + $this->trail_controller = new \PHPPgAdmin\XHtml\HTMLNavbarController( + $this->getContainer(), + $this->controller_name + ); } return $this->trail_controller; } - private function _getTreeController() + /** + * Gets the tree instance. + * + * @param \Slim\Container $container the $app container + * @param $controller_name The controller name + * + * @return \PHPPgAdmin\XHtml\TreeController The tree controller instance. + */ + private static function _getTreeInstance($container, $controller_name) { - if (null === $this->tree_controller) { - $this->tree_controller = new \PHPPgAdmin\XHtml\TreeController($this->getContainer(), $this->controller_name); + if (null === self::$_tree_controller) { + self::$_tree_controller = new \PHPPgAdmin\XHtml\TreeController( + $container, + $controller_name + ); } - return $this->tree_controller; + return self::$_tree_controller; + } + + /** + * Gets the tree controller. + * + * @param string $from From where is this method being called, for debug purposes + * + * @return \PHPPgAdmin\XHtml\TreeController The tree controller. + */ + private function _getTreeController($from) + { + //$tree = self::_getTreeInstance($this->getContainer(), $this->controller_name); + $tree = new \PHPPgAdmin\XHtml\TreeController($this->getContainer(), $this->controller_name); + $this->prtrace(__METHOD__); + return $tree; + } /** @@ -229,7 +271,8 @@ class BaseController public function adjustTabsForTree($tabs) { - $tree = $this->_getTreeController(); + //$tree = self::_getTreeInstance($this->getContainer(), $this->controller_name); + $tree = $this->_getTreeController(__METHOD__); return $tree->adjustTabsForTree($tabs); } @@ -240,15 +283,24 @@ class BaseController * @param \PHPPgAdmin\ArrayRecordSet $_treedata a set of records to populate the tree * @param array $attrs Attributes for tree items * @param string $section The section where the branch is linked in the tree - * @param bool $print either to return or echo the result * - * @return \Slim\Http\Response|string the json rendered tree + * @return string the json rendered tree */ - public function printTree(&$_treedata, &$attrs, $section, $print = true) + public function printTree(&$_treedata, &$attrs, $section) { - $tree = $this->_getTreeController(); - return $tree->printTree($_treedata, $attrs, $section, $print); + $tree = $this->_getTreeController(__METHOD__); + + $treedata = []; + + if ($_treedata->recordCount() > 0) { + while (!$_treedata->EOF) { + $treedata[] = $_treedata->fields; + $_treedata->moveNext(); + } + } + + return $tree->printTreeJSON($treedata, $attrs, $section); } public function printTrail($trail = [], $do_print = true) @@ -300,11 +352,25 @@ class BaseController return $footer_controller->setNoBottomLink($flag); } - public function printFooter($doBody = true, $template = 'footer.twig') + /** + * Prints or returns the controller's footer + * + * @param boolean $doBody If false, return the body instead of print. Defaults to true + * @param string $template The template to render + * @param array $viewParams Optional - extra view parameters + * + * @return ( description_of_the_return_value ) + */ + public function printFooter($doBody = true, $template = 'footer.twig', $viewParams = []) { $footer_controller = $this->_getFooterController(); - return $footer_controller->printFooter($doBody, $template); + $footer_html = $footer_controller->getFooter($template, $viewParams); + if ($doBody) { + echo $footer_html; + } else { + return $footer_html; + } } public function printReload($database, $do_print = true) @@ -397,7 +463,7 @@ class BaseController $html = ''; $msg = htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($msg)); if ('' != $msg) { - $html .= '

'.nl2br($msg).'

'.PHP_EOL; + $html .= '

' . nl2br($msg) . '

' . PHP_EOL; } if ($do_print) { echo $html; diff --git a/src/controllers/BrowserController.php b/src/controllers/BrowserController.php index 7fbf51e6..a7b351cb 100644 --- a/src/controllers/BrowserController.php +++ b/src/controllers/BrowserController.php @@ -1,7 +1,7 @@ fields['consrc'])) { $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $rowdata->fields['indkey'])); - $rowdata->fields['+definition'] = ('u' == $rowdata->fields['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (').join(',', $atts).')'; + $rowdata->fields['+definition'] = ('u' == $rowdata->fields['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (').implode(',', $atts).')'; } else { $rowdata->fields['+definition'] = $rowdata->fields['consrc']; } @@ -329,7 +327,7 @@ class ConstraintsController extends BaseController // Check that they've given at least one source column if (!isset($_REQUEST['SourceColumnList']) && (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) || - 0 == sizeof($_POST['IndexColumnList']))) { + 0 == count($_POST['IndexColumnList']))) { return $this->formAddForeignKey($this->lang['strfkneedscols']); } // Copy the IndexColumnList variable from stage 1 @@ -476,8 +474,8 @@ class ConstraintsController extends BaseController // If IndexColumnList or SourceColumnList are empty, return to screen to select referencing table columns if (!is_array($_POST['IndexColumnList']) - || 0 == sizeof($_POST['IndexColumnList']) - || 0 == sizeof($temp)) { + || 0 == count($_POST['IndexColumnList']) + || 0 == count($temp)) { return $this->_selectFKColumns($this->lang['strfkneedscols']); } @@ -624,7 +622,7 @@ class ConstraintsController extends BaseController if ('primary' == $type) { // Check that they've given at least one column if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) - || 0 == sizeof($_POST['IndexColumnList']) + || 0 == count($_POST['IndexColumnList']) ) { $this->formPrimaryOrUniqueKey($type, $this->lang['strpkneedscols']); } else { @@ -638,7 +636,7 @@ class ConstraintsController extends BaseController } elseif ('unique' == $type) { // Check that they've given at least one column if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) - || 0 == sizeof($_POST['IndexColumnList']) + || 0 == count($_POST['IndexColumnList']) ) { $this->formPrimaryOrUniqueKey($type, $this->lang['struniqneedscols']); } else { diff --git a/src/controllers/ConversionsController.php b/src/controllers/ConversionsController.php index 45fc0d3d..121793e2 100644 --- a/src/controllers/ConversionsController.php +++ b/src/controllers/ConversionsController.php @@ -1,7 +1,7 @@ action || 'processes' == $this->action) { - $scripts .= ''; + $scripts .= ''; $refreshTime = $this->conf['ajax_refresh'] * 1500; - $scripts .= ''.PHP_EOL; + $scripts .= '' . PHP_EOL; } $header_template = 'header.twig'; @@ -121,7 +119,7 @@ class DatabaseController extends BaseController $this->printFooter(true, $footer_template); } - public function doTree($print = true) + public function doTree() { $reqvars = $this->misc->getRequestVars('database'); $tabs = $this->misc->getNavTabs('database'); @@ -149,7 +147,7 @@ class DatabaseController extends BaseController ), ]; - return $this->printTree($items, $attrs, 'database', $print); + return $this->printTree($items, $attrs, 'database'); } /** @@ -185,11 +183,11 @@ class DatabaseController extends BaseController $this->printTabs('database', 'find'); $this->printMsg($msg); - echo '
'.PHP_EOL; + echo '' . PHP_EOL; echo '

_maxNameLen}\" />".PHP_EOL; + "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />" . PHP_EOL; // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities - echo '' . PHP_EOL; echo $this->_printTypeOption(''); echo $this->_printTypeOption('COLUMN'); @@ -213,12 +211,12 @@ class DatabaseController extends BaseController echo $this->_printTypeOption('LANGUAGE'); } - echo ''.PHP_EOL; - echo "lang['strfind']}\" />".PHP_EOL; + echo '' . PHP_EOL; + echo "lang['strfind']}\" />" . PHP_EOL; echo $this->misc->form; - echo '

'.PHP_EOL; - echo '

'.PHP_EOL; - echo '
'.PHP_EOL; + echo '

' . PHP_EOL; + echo '

' . PHP_EOL; + echo '' . PHP_EOL; // Default focus $this->setFocus('forms[0].term'); @@ -235,7 +233,7 @@ class DatabaseController extends BaseController $filter = $_REQUEST['filter']; $optionhtml = sprintf('%s'.PHP_EOL; + $optionhtml .= '' . PHP_EOL; return $optionhtml; } @@ -279,95 +277,95 @@ class DatabaseController extends BaseController { switch ($curr) { case 'SCHEMA': - echo '
  • misc->href}&schema="; + echo '
  • misc->href}&schema="; echo $this->misc->printVal($rs->fields['name']), '">'; echo $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']); - echo '
  • '.PHP_EOL; + echo '' . PHP_EOL; break; case 'TABLE': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', - urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', + urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'VIEW': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', - urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', + urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'SEQUENCE': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), - '&sequence=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + '&sequence=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'COLUMNTABLE': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'COLUMNVIEW': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'INDEX': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; - echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; + echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'CONSTRAINTTABLE': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', - urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'CONSTRAINTDOMAIN': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&domain=', urlencode($rs->fields['relname']), '">', - $this->misc->printVal($rs->fields['relname']), '.', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->misc->printVal($rs->fields['relname']), '.', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'TRIGGER': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'RULETABLE': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=table&table=', - urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'RULEVIEW': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; - echo 'misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=view&view=', - urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'FUNCTION': @@ -375,53 +373,53 @@ class DatabaseController extends BaseController echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&function=', urlencode($rs->fields['name']), '&function_oid=', urlencode($rs->fields['oid']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), ''.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'TYPE': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&type=', - urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'DOMAIN': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&domain=', - urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'OPERATOR': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '&operator=', - urlencode($rs->fields['name']), '&operator_oid=', urlencode($rs->fields['oid']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + urlencode($rs->fields['name']), '&operator_oid=', urlencode($rs->fields['oid']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'CONVERSION': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), - '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'LANGUAGE': - echo "
  • misc->href}\">", $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + echo "
  • misc->href}\">", $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • ' . PHP_EOL; break; case 'AGGREGATE': echo '
  • '; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; case 'OPCLASS': echo '
  • '; - echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; + echo 'misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '.'; echo "misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', - $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '
  • '.PHP_EOL; + $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '' . PHP_EOL; break; } @@ -446,25 +444,25 @@ class DatabaseController extends BaseController $curr = $rs->fields['type']; } else { if ('' != $curr) { - echo ''.PHP_EOL; + echo '' . PHP_EOL; } $curr = $rs->fields['type']; echo '

    '; echo $this->_translatedType($curr); echo '

    '; - echo '
      '.PHP_EOL; + echo '
        ' . PHP_EOL; } } $this->_printHtmlForType($curr, $rs); $rs->moveNext(); } - echo '
      '.PHP_EOL; + echo '
    ' . PHP_EOL; - echo '

    ', $rs->recordCount(), ' ', $this->lang['strobjects'], '

    '.PHP_EOL; + echo '

    ', $rs->recordCount(), ' ', $this->lang['strobjects'], '

    ' . PHP_EOL; } else { - echo "

    {$this->lang['strnoobjects']}

    ".PHP_EOL; + echo "

    {$this->lang['strnoobjects']}

    " . PHP_EOL; } } @@ -539,7 +537,7 @@ class DatabaseController extends BaseController $this->printMsg($msg); if (0 === strlen($msg)) { - echo '
    \"{$this-lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}"; + echo '
    \"{$this-lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}"; } echo '
    '; @@ -553,7 +551,7 @@ class DatabaseController extends BaseController // Display prepared transactions if ($data->hasPreparedXacts()) { - echo "

    {$this->lang['strpreparedxacts']}

    ".PHP_EOL; + echo "

    {$this->lang['strpreparedxacts']}

    " . PHP_EOL; $prep_xacts = $data->getPreparedXacts($_REQUEST['database']); $columns = [ @@ -581,7 +579,7 @@ class DatabaseController extends BaseController } // Fetch the processes from the database - echo "

    {$this->lang['strprocesses']}

    ".PHP_EOL; + echo "

    {$this->lang['strprocesses']}

    " . PHP_EOL; $processes = $data->getProcesses($_REQUEST['database']); $columns = [ @@ -721,7 +719,7 @@ class DatabaseController extends BaseController $this->printTrail('database'); $this->printTabs('database', 'locks'); - echo '
    \"{$this-lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}"; + echo '
    \"{$this-lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}"; echo '
    '; $this->currentLocks(); @@ -740,27 +738,27 @@ class DatabaseController extends BaseController $this->printTrail('database'); $this->printTabs('database', 'sql'); - echo "

    {$this->lang['strentersql']}

    ".PHP_EOL; - echo '
    '.PHP_EOL; - echo "

    {$this->lang['strsql']}
    ".PHP_EOL; + echo "

    {$this->lang['strentersql']}

    " . PHP_EOL; + echo '' . PHP_EOL; + echo "

    {$this->lang['strsql']}
    " . PHP_EOL; echo '

    '.PHP_EOL; + htmlspecialchars($_SESSION['sqlquery']), '

    ' . PHP_EOL; // Check that file uploads are enabled if (ini_get('file_uploads')) { // Don't show upload option if max size of uploads is zero $max_size = $this->misc->inisizeToBytes(ini_get('upload_max_filesize')); - if (is_double($max_size) && $max_size > 0) { - echo "

    ".PHP_EOL; - echo "

    ".PHP_EOL; + if (is_float($max_size) && $max_size > 0) { + echo "

    " . PHP_EOL; + echo "

    " . PHP_EOL; } } - echo '

    ".PHP_EOL; - echo "

    lang['strexecute']}\" />".PHP_EOL; + echo '

    " . PHP_EOL; + echo "

    lang['strexecute']}\" />" . PHP_EOL; echo $this->misc->form; - echo "lang['strreset']}\" />

    ".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['strreset']}\" />

    " . PHP_EOL; + echo '' . PHP_EOL; // Default focus $this->setFocus('forms[0].query'); diff --git a/src/controllers/DataexportController.php b/src/controllers/DataexportController.php index 6f627103..eabb59d6 100644 --- a/src/controllers/DataexportController.php +++ b/src/controllers/DataexportController.php @@ -1,15 +1,13 @@ insertRow($_REQUEST['table'], $fields, $vars, $nulls, $format, $types); if (0 != $status) { @@ -262,7 +260,7 @@ class DataimportController extends BaseController $format[$i] = 'VALUE'; // Type is always text $types[$i] = 'text'; - ++$i; + $i++; } $status = $data->insertRow($_REQUEST['table'], $t_fields, $vars, $nulls, $format, $types); @@ -270,7 +268,7 @@ class DataimportController extends BaseController $data->rollbackTransaction(); $this->halt(sprintf($this->lang['strimporterrorline'], $row)); } - ++$row; + $row++; } break; diff --git a/src/controllers/DbexportController.php b/src/controllers/DbexportController.php index 09c2596e..6f3bf29f 100644 --- a/src/controllers/DbexportController.php +++ b/src/controllers/DbexportController.php @@ -1,15 +1,13 @@ misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])); echo ''; - ++$elements; + $elements++; echo ''.PHP_EOL; echo '\n".PHP_EOL; - ++$elements; + $elements++; echo ''; // Output null box if the column allows nulls (doesn't look at CHECKs or ASSERTIONS) if (!$attrs->fields['attnotnull']) { @@ -786,7 +784,7 @@ class DisplayController extends BaseController } echo "'.PHP_EOL; - ++$elements; + $elements++; } else { echo ' '; } @@ -811,9 +809,9 @@ class DisplayController extends BaseController echo $data->printField("values[{$attrs->fields['attname']}]", $resultset->fields[$attrs->fields['attname']], $attrs->fields['type'], $extras); echo ''; - ++$elements; + $elements++; echo ''.PHP_EOL; - ++$i; + $i++; $attrs->moveNext(); } echo ''.PHP_EOL; @@ -1118,7 +1116,7 @@ class DisplayController extends BaseController list($min_page, $max_page) = $this->_getMinMaxPages($page, $pages); - for ($i = $min_page; $i <= $max_page; ++$i) { + for ($i = $min_page; $i <= $max_page; $i++) { $result .= (($i === $page) ? $i : sprintf('%s', $url, $i, $i)).PHP_EOL; } diff --git a/src/controllers/DomainsController.php b/src/controllers/DomainsController.php index 3cb0afb7..776c4c87 100644 --- a/src/controllers/DomainsController.php +++ b/src/controllers/DomainsController.php @@ -1,7 +1,7 @@ phpArray($fndata->fields['proargnames']); $modes_arr = $data->phpArray($fndata->fields['proargmodes']); $args = ''; - $args_arr_size = sizeof($args_arr); - for ($i = 0; $i < $args_arr_size; ++$i) { + $args_arr_size = count($args_arr); + for ($i = 0; $i < $args_arr_size; $i++) { if (0 != $i) { $args .= ', '; } @@ -576,7 +574,7 @@ class FunctionsController extends BaseController } // Display function properties - if (is_array($data->funcprops) && sizeof($data->funcprops) > 0) { + if (is_array($data->funcprops) && count($data->funcprops) > 0) { echo "{$this->lang['strproperties']}".PHP_EOL; echo ''.PHP_EOL; $i = 0; @@ -588,7 +586,7 @@ class FunctionsController extends BaseController '>', $this->misc->printVal($p), ''.PHP_EOL; } echo '
    '.PHP_EOL; - ++$i; + $i++; } echo ''.PHP_EOL; } @@ -746,7 +744,7 @@ class FunctionsController extends BaseController } // Show flags - if (is_array($data->funcprops) && sizeof($data->funcprops) > 0) { + if (is_array($data->funcprops) && count($data->funcprops) > 0) { // Fetch an array of the function properties $funcprops = $data->getFunctionProperties($funcdata->fields); echo "{$this->lang['strproperties']}".PHP_EOL; @@ -1067,7 +1065,7 @@ class FunctionsController extends BaseController } // Display function properties - if (is_array($data->funcprops) && sizeof($data->funcprops) > 0) { + if (is_array($data->funcprops) && count($data->funcprops) > 0) { echo "{$this->lang['strproperties']}".PHP_EOL; echo ''.PHP_EOL; $i = 0; @@ -1079,7 +1077,7 @@ class FunctionsController extends BaseController '>', $this->misc->printVal($p), ''.PHP_EOL; } echo '
    '.PHP_EOL; - ++$i; + $i++; } echo ''.PHP_EOL; } @@ -1214,7 +1212,7 @@ class FunctionsController extends BaseController $szReturn .= ';'; - ++$nC; + $nC++; } return $szReturn; @@ -1264,8 +1262,8 @@ class FunctionsController extends BaseController $names_arr = $data->phpArray($funcdata->fields['proargnames']); $modes_arr = $data->phpArray($funcdata->fields['proargmodes']); $args = ''; - $args_arr_size = sizeof($args_arr); - for ($i = 0; $i < $args_arr_size; ++$i) { + $args_arr_size = count($args_arr); + for ($i = 0; $i < $args_arr_size; $i++) { if (0 != $i) { $args .= ', '; } diff --git a/src/controllers/GroupsController.php b/src/controllers/GroupsController.php index 44d513e3..7c0e759e 100644 --- a/src/controllers/GroupsController.php +++ b/src/controllers/GroupsController.php @@ -1,7 +1,7 @@ setWindowName('history'); - return $this->printFooter(true, 'footer_sqledit.twig'); + return $this->printFooter(true, 'footer_sqledit.twig', true); } public function doDefault() @@ -70,14 +68,14 @@ class HistoryController extends BaseController $this->printHeader($this->headerTitle(), $this->scripts, true, 'header.twig'); // Bring to the front always - echo ''.PHP_EOL; + echo '' . PHP_EOL; - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; $this->printConnection('history'); echo '

    '; if (!isset($_REQUEST['database'])) { - echo "

    {$this->lang['strnodatabaseselected']}

    ".PHP_EOL; + echo "

    {$this->lang['strnodatabaseselected']}

    " . PHP_EOL; return; } @@ -133,7 +131,7 @@ class HistoryController extends BaseController echo $this->printTable($history, $columns, $actions, 'history-history', $this->lang['strnohistory']); } else { - echo "

    {$this->lang['strnohistory']}

    ".PHP_EOL; + echo "

    {$this->lang['strnohistory']}

    " . PHP_EOL; } $navlinks = [ @@ -191,19 +189,19 @@ class HistoryController extends BaseController $this->printHeader($this->headerTitle(), $this->scripts); // Bring to the front always - echo ''.PHP_EOL; + echo '' . PHP_EOL; - echo "

    {$this->lang['strdelhistory']}

    ".PHP_EOL; - echo "

    {$this->lang['strconfdelhistory']}

    ".PHP_EOL; + echo "

    {$this->lang['strdelhistory']}

    " . PHP_EOL; + echo "

    {$this->lang['strconfdelhistory']}

    " . PHP_EOL; echo '
    ', htmlentities($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]['query'], ENT_QUOTES, 'UTF-8'), '
    '; - echo '
    '.PHP_EOL; - echo ''.PHP_EOL; - echo "".PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo "" . PHP_EOL; echo $this->misc->form; - echo "lang['stryes']}\" />".PHP_EOL; - echo "lang['strno']}\" />".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['stryes']}\" />" . PHP_EOL; + echo "lang['strno']}\" />" . PHP_EOL; + echo '' . PHP_EOL; } else { unset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]); } @@ -215,17 +213,17 @@ class HistoryController extends BaseController $this->printHeader($this->headerTitle(), $this->scripts); // Bring to the front always - echo ''.PHP_EOL; + echo '' . PHP_EOL; - echo "

    {$this->lang['strclearhistory']}

    ".PHP_EOL; - echo "

    {$this->lang['strconfclearhistory']}

    ".PHP_EOL; + echo "

    {$this->lang['strclearhistory']}

    " . PHP_EOL; + echo "

    {$this->lang['strconfclearhistory']}

    " . PHP_EOL; - echo '
    '.PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "lang['stryes']}\" />".PHP_EOL; - echo "lang['strno']}\" />".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['stryes']}\" />" . PHP_EOL; + echo "lang['strno']}\" />" . PHP_EOL; + echo '' . PHP_EOL; } else { unset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']]); } diff --git a/src/controllers/IndexesController.php b/src/controllers/IndexesController.php index 4256bc0a..4b28fa47 100644 --- a/src/controllers/IndexesController.php +++ b/src/controllers/IndexesController.php @@ -1,7 +1,7 @@ ", $this->misc->printVal($tablestatstups->fields['n_tup_del'], 'int4', $this->shownull), ''.PHP_EOL; echo "\t".PHP_EOL; $tablestatstups->movenext(); - ++$i; + $i++; } echo ''.PHP_EOL; @@ -258,7 +256,7 @@ class InfoController extends BaseController echo "\t\t({$percentage}{$this->lang['strpercent']})".PHP_EOL; echo "\t".PHP_EOL; $tablestatsio->movenext(); - ++$i; + $i++; } echo ''.PHP_EOL; @@ -286,7 +284,7 @@ class InfoController extends BaseController echo "\t\t", $this->misc->printVal($indexstatstups->fields['idx_tup_fetch'], 'int4', $this->shownull), ''.PHP_EOL; echo "\t".PHP_EOL; $indexstatstups->movenext(); - ++$i; + $i++; } echo ''.PHP_EOL; @@ -321,7 +319,7 @@ class InfoController extends BaseController echo "\t\t({$percentage}{$this->lang['strpercent']})".PHP_EOL; echo "\t".PHP_EOL; $indexstatsio->movenext(); - ++$i; + $i++; } echo ''.PHP_EOL; diff --git a/src/controllers/IntroController.php b/src/controllers/IntroController.php index c45f0bbe..2a95b6a3 100644 --- a/src/controllers/IntroController.php +++ b/src/controllers/IntroController.php @@ -1,15 +1,13 @@ '; $login_html .= ''; $login_html .= ''; - if (sizeof($this->conf['servers']) > 1) { + if (count($this->conf['servers']) > 1) { $checked = isset($_POST['loginShared']) ? 'checked="checked"' : ''; $login_html .= '

    '; $login_html .= '

    '; diff --git a/src/controllers/MaterializedviewpropertiesController.php b/src/controllers/MaterializedviewpropertiesController.php index 49f0d0e0..11c3b38c 100644 --- a/src/controllers/MaterializedviewpropertiesController.php +++ b/src/controllers/MaterializedviewpropertiesController.php @@ -1,15 +1,13 @@ getPrivileges($object, $subject); } - if (sizeof($privileges) > 0) { + if (count($privileges) > 0) { echo ''.PHP_EOL; if ($data->hasRoles()) { echo ""; @@ -150,7 +150,7 @@ class PrivilegesController extends BaseController echo ''.PHP_EOL; } echo ''.PHP_EOL; - ++$i; + $i++; } echo '
    {$this->lang['strrole']}', $this->misc->printVal($v[3]), '
    '; diff --git a/src/controllers/RolesController.php b/src/controllers/RolesController.php index 69741a98..c7dbc4d2 100644 --- a/src/controllers/RolesController.php +++ b/src/controllers/RolesController.php @@ -1,7 +1,7 @@ \n"; - for ($k = 0; $k < $num_fields; ++$k) { + for ($k = 0; $k < $num_fields; $k++) { echo ''; } @@ -145,7 +143,7 @@ class SqlController extends BaseController } echo ''.PHP_EOL; $row = pg_fetch_row($rs); - ++$i; + $i++; } echo '
    ', $misc->printVal(pg_fieldname($rs, $k)), '

    '.PHP_EOL; @@ -218,7 +216,7 @@ class SqlController extends BaseController } echo ''.PHP_EOL; $rs->moveNext(); - ++$i; + $i++; } echo ''.PHP_EOL; echo '

    ', $rs->recordCount(), " {$this->lang['strrows']}

    ".PHP_EOL; diff --git a/src/controllers/SqleditController.php b/src/controllers/SqleditController.php index 6e329766..0a746623 100644 --- a/src/controllers/SqleditController.php +++ b/src/controllers/SqleditController.php @@ -1,15 +1,13 @@ printHeader($title, $this->scripts, true, 'header_sqledit.twig'); $this->printBody(true, 'sql_edit'); echo $body_text; - - $this->printFooter(true, 'footer_sqledit.twig'); + $this->container->get('view')->offsetSet('inPopUp', true); + $this->printFooter(true, 'footer_sqledit.twig', true); } /** @@ -67,7 +65,7 @@ class SqleditController extends BaseController $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'sql', false); - $default_html .= '
    '; + $default_html .= ''; $default_html .= PHP_EOL; $default_html .= $this->printConnection('sql', false); @@ -77,48 +75,48 @@ class SqleditController extends BaseController $default_html .= ''.PHP_EOL; + $default_html .= ': '; + $default_html .= '' . PHP_EOL; - $default_html .= '
    '.PHP_EOL; + $default_html .= '
    ' . PHP_EOL; $default_html .= '
    '; $default_html .= PHP_EOL; - $default_html .= ''; + $default_html .= ''; $default_html .= PHP_EOL; - $default_html .= '
    '.PHP_EOL; + $default_html .= '' . PHP_EOL; $default_html .= '
    '; if (ini_get('file_uploads')) { // Don't show upload option if max size of uploads is zero $max_size = $this->misc->inisizeToBytes(ini_get('upload_max_filesize')); - if (is_double($max_size) && $max_size > 0) { + if (is_float($max_size) && $max_size > 0) { $default_html .= '

    '; - $default_html .= ''; + $default_html .= ''; $default_html .= PHP_EOL; - $default_html .= ''; + $default_html .= ''; $default_html .= '  

    '; - $default_html .= '

    '.PHP_EOL; + $default_html .= '

    ' . PHP_EOL; } } // Check that file uploads are enabled $checked = (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''); - $default_html .= '

    '; + $default_html .= '

    '; $default_html .= PHP_EOL; - $default_html .= '

    '; + $default_html .= '

    '; $default_html .= PHP_EOL; $default_html .= '

    '; $default_html .= ''.PHP_EOL; - $default_html .= '

    '.PHP_EOL; + $default_html .= ' ' . $this->lang['strpaginate'] . ' '; + $default_html .= '' . PHP_EOL; + $default_html .= '

    ' . PHP_EOL; - $default_html .= '
    '.PHP_EOL; + $default_html .= '' . PHP_EOL; $default_html .= ''; $default_html .= PHP_EOL; @@ -173,9 +171,9 @@ class SqleditController extends BaseController $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'find', false); - $default_html .= '
    '.PHP_EOL; + $default_html .= '' . PHP_EOL; $default_html .= $this->printConnection('find', false); - $default_html .= '

    _maxNameLen}\" />".PHP_EOL; + $default_html .= '

    _maxNameLen}\" />" . PHP_EOL; $filters = $this->_getFilters(); $advanced_filters = $this->_getAdvancedFilters(); @@ -189,22 +187,22 @@ class SqleditController extends BaseController } // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities - $default_html .= "" . PHP_EOL; + $default_html .= sprintf('%s" . PHP_EOL, "\t"); foreach ($filters as $type => $props) { - $default_html .= sprintf('%s'.PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); + $default_html .= sprintf('%s' . PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); } if ($this->conf['show_advanced']) { foreach ($advanced_filters as $type => $props) { - $default_html .= sprintf('%s'.PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); + $default_html .= sprintf('%s' . PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); } } - $default_html .= ''.PHP_EOL; + $default_html .= '' . PHP_EOL; - $default_html .= "lang['strfind']}\" />".PHP_EOL; - $default_html .= '

    '.PHP_EOL; - $default_html .= '
    '.PHP_EOL; + $default_html .= "lang['strfind']}\" />" . PHP_EOL; + $default_html .= '

    ' . PHP_EOL; + $default_html .= '' . PHP_EOL; // Default focus $this->setFocus('forms[0].term'); diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php index 329f99bd..cd273b6e 100644 --- a/src/controllers/TablesController.php +++ b/src/controllers/TablesController.php @@ -1,7 +1,7 @@ [ 'title' => $this->lang['strtable'], 'field' => Decorator::field('relname'), - 'url' => \SUBFOLDER."/redirect/table?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&", 'vars' => ['table' => 'relname'], ], 'owner' => [ @@ -323,8 +321,6 @@ class TablesController extends BaseController //\Kint::dump($tables); - echo $this->printTable($tables, $columns, $actions, $this->table_place, $this->lang['strnotables']); - $navlinks = [ 'create' => [ 'attr' => [ @@ -358,7 +354,15 @@ class TablesController extends BaseController 'content' => $this->lang['strcreatetablelike'], ]; } - $this->printNavLinks($navlinks, 'tables-tables', get_defined_vars()); + $tablesContent = $this->printTable( + $tables, + $columns, + $actions, + $this->table_place, + $this->lang['strnotables'] + ); + + $navLinks = $this->printNavLinks($navlinks, 'tables-tables', get_defined_vars(), false); } public function displayJson() @@ -469,46 +473,46 @@ class TablesController extends BaseController $this->printTitle($this->lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo '
    '; + echo ''; echo PHP_EOL; - echo ''.PHP_EOL; - echo "\t\n\t\t".PHP_EOL; + echo '
    {$this->lang['strname']}
    ' . PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; echo "\t\t\n\t".PHP_EOL; - echo "\t\n\t\t".PHP_EOL; + htmlspecialchars($_REQUEST['name']), "\" />\n\t" . PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; echo "\t\t\n\t".PHP_EOL; - echo "\t\n\t\t".PHP_EOL; - echo "\t\t\n\t".PHP_EOL; + htmlspecialchars($_REQUEST['fields']), "\" />\n\t" . PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; + echo "\t\t\n\t" . PHP_EOL; // Tablespace (if there are any) if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) { - echo "\t\n\t\t".PHP_EOL; - echo "\t\t\n\t\t" . PHP_EOL; + echo "\t\t\n\t".PHP_EOL; + echo "\t\t\t\n\t\t\n\t" . PHP_EOL; } - echo "\t\n\t\t".PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; echo "\t\t\n\t".PHP_EOL; + htmlspecialchars($_REQUEST['tblcomment']), "\n\t" . PHP_EOL; - echo '
    {$this->lang['strname']}_maxNameLen}\" value=\"", - htmlspecialchars($_REQUEST['name']), "\" />
    {$this->lang['strnumcols']}
    {$this->lang['strnumcols']}_maxNameLen}\" value=\"", - htmlspecialchars($_REQUEST['fields']), "\" />
    {$this->lang['stroptions']}
    {$this->lang['stroptions']}
    {$this->lang['strtablespace']}\n\t\t\t
    {$this->lang['strtablespace']}\n\t\t\t\n\t\t
    {$this->lang['strcomment']}
    {$this->lang['strcomment']}
    '.PHP_EOL; - echo '

    '.PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; + echo '

    ' . PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "lang['strnext']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />

    ".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['strnext']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />

    " . PHP_EOL; + echo '' . PHP_EOL; break; case 2: @@ -534,17 +538,17 @@ class TablesController extends BaseController $this->printTitle($this->lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo ''; - echo '
    '.PHP_EOL; + echo ''; + echo '' . PHP_EOL; // Output table header - echo ''.PHP_EOL; + echo '
    ' . PHP_EOL; echo "\t"; echo ""; echo ""; - echo "".PHP_EOL; + echo "" . PHP_EOL; - for ($i = 0; $i < $_REQUEST['fields']; ++$i) { + for ($i = 0; $i < $_REQUEST['fields']; $i++) { if (!isset($_REQUEST['field'][$i])) { $_REQUEST['field'][$i] = ''; } @@ -561,16 +565,16 @@ class TablesController extends BaseController $_REQUEST['colcomment'][$i] = ''; } - echo "\t\n\t\t'.PHP_EOL; + echo "\t\n\t\t' . PHP_EOL; echo "\t\t'.PHP_EOL; - echo "\t\t' . PHP_EOL; + echo "\t\t"; + echo '\n\t"; } // Output array type selector - echo "\t\t".PHP_EOL; + echo "\t\t" . PHP_EOL; echo "\t\t'.PHP_EOL; - echo "\t\t'.PHP_EOL; + htmlspecialchars($_REQUEST['length'][$i]), '" />' . PHP_EOL; + echo "\t\t' . PHP_EOL; echo "\t\t'.PHP_EOL; + . (isset($_REQUEST['uniquekey'][$i]) ? ' checked="checked"' : '') . ' />' . PHP_EOL; echo "\t\t'.PHP_EOL; + . (isset($_REQUEST['primarykey'][$i]) ? ' checked="checked"' : '') + . ' />' . PHP_EOL; echo "\t\t'.PHP_EOL; + htmlspecialchars($_REQUEST['default'][$i]), '" />' . PHP_EOL; echo "\t\t\n\t".PHP_EOL; + \n\t" . PHP_EOL; } - echo '
    {$this->lang['strcolumn']}{$this->lang['strtype']}{$this->lang['strlength']}{$this->lang['strnotnull']}{$this->lang['struniquekey']}{$this->lang['strprimarykey']}{$this->lang['strdefault']}{$this->lang['strcomment']}
    {$this->lang['strdefault']}{$this->lang['strcomment']}
    ", $i + 1, '. 
    ", $i + 1, '. _maxNameLen}\" value=\"", - htmlspecialchars($_REQUEST['field'][$i]), '" />\n\t\t\t\n\t\t\t\n\t\t\n"; @@ -589,46 +593,46 @@ class TablesController extends BaseController foreach ($predefined_size_types as $value) { $escaped_predef_types[] = "'{$value}'"; } - echo '\n\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t -
    '.PHP_EOL; - echo '

    '.PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; + echo '

    ' . PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo ''.PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; if (isset($_REQUEST['withoutoids'])) { - echo ''.PHP_EOL; + echo '' . PHP_EOL; } - echo ''.PHP_EOL; + echo '' . PHP_EOL; if (isset($_REQUEST['spcname'])) { - echo ''.PHP_EOL; + echo '' . PHP_EOL; } - echo "lang['strcreate']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />

    ".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['strcreate']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />

    " . PHP_EOL; + echo '' . PHP_EOL; break; case 3: @@ -693,7 +697,7 @@ class TablesController extends BaseController break; default: - echo "

    {$this->lang['strinvalidparam']}

    ".PHP_EOL; + echo "

    {$this->lang['strinvalidparam']}

    " . PHP_EOL; } } @@ -736,13 +740,13 @@ class TablesController extends BaseController unset($tbltmp); - echo '
    '.PHP_EOL; - echo "\n\t\n\t\t".PHP_EOL; - echo "\t\t\n\t".PHP_EOL; - echo "\t\n\t\t".PHP_EOL; + echo '' . PHP_EOL; + echo "
    {$this->lang['strname']}_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" />
    {$this->lang['strcreatetablelikeparent']}
    \n\t\n\t\t" . PHP_EOL; + echo "\t\t\n\t" . PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; echo "\t\t\n\t".PHP_EOL; + echo "\n\t" . PHP_EOL; if ($data->hasTablespaces()) { $tblsp_ = $data->getTablespaces(); if ($tblsp_->recordCount() > 0) { @@ -752,10 +756,10 @@ class TablesController extends BaseController $tblsp[$a['spcname']] = $a['spcname']; } - echo "\t\n\t\t".PHP_EOL; + echo "\t\n\t\t" . PHP_EOL; echo "\t\t\n\t".PHP_EOL; + echo "\n\t" . PHP_EOL; } } echo "\t\n\t\t\n\t\t\n\t".PHP_EOL; + echo "\n\t" . PHP_EOL; echo '
    {$this->lang['strname']}_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" />
    {$this->lang['strcreatetablelikeparent']}"; echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tables, 'like', true, $tblsel, false); - echo "
    {$this->lang['strtablespace']}
    {$this->lang['strtablespace']}"; echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tblsp, 'tablespace', true, $_REQUEST['tablespace'], false); - echo "
    {$this->lang['stroptions']}"; @@ -772,14 +776,14 @@ class TablesController extends BaseController isset($_REQUEST['withindexes']) ? ' checked="checked"' : '', "/>{$this->lang['strcreatelikewithindexes']}"; } - echo "
    '; - echo ''.PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "

    lang['strcreate']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />

    ".PHP_EOL; - echo '
    '.PHP_EOL; + echo "

    lang['strcreate']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />

    " . PHP_EOL; + echo '' . PHP_EOL; } else { if ('' == trim($_REQUEST['name'])) { $this->doCreateLike(false, $this->lang['strtableneedsname']); @@ -831,10 +835,10 @@ class TablesController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['table']); - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; if ($attrs->recordCount() > 0) { // JavaScript for select all feature - echo ''.PHP_EOL; + echo '//]]>' . PHP_EOL; + echo '' . PHP_EOL; - echo ''.PHP_EOL; + echo '
    ' . PHP_EOL; // Output table header echo ""; @@ -866,42 +870,42 @@ class TablesController extends BaseController // Continue drawing row $id = (0 == ($i % 2) ? '1' : '2'); - echo "".PHP_EOL; + echo "" . PHP_EOL; echo ''; echo ''; echo ''; echo '".PHP_EOL; + echo "\n" . PHP_EOL; echo ''; - echo ''.PHP_EOL; - ++$i; + echo '' . PHP_EOL; + $i++; $attrs->moveNext(); } // Select all checkbox echo ""; - echo '
    {$this->lang['strshow']}{$this->lang['strcolumn']}
    '; echo 'fields['attname']]) ? ' checked="checked"' : '', ' />', $this->misc->printVal($attrs->fields['attname']), '', $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])), ''; - echo "fields['attname']}]\">" . PHP_EOL; foreach (array_keys($data->selectOps) as $v) { echo ''.PHP_EOL; + '>', htmlspecialchars($v), '' . PHP_EOL; } - echo "\n', $data->printField( "values[{$attrs->fields['attname']}]", $_REQUEST['values'][$attrs->fields['attname']], $attrs->fields['type'] ), '
    '.PHP_EOL; + echo '' . PHP_EOL; } else { - echo "

    {$this->lang['strinvalidparam']}

    ".PHP_EOL; + echo "

    {$this->lang['strinvalidparam']}

    " . PHP_EOL; } - echo '

    '.PHP_EOL; - echo ''.PHP_EOL; - echo ''.PHP_EOL; + echo '

    ' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "lang['strselect']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />

    ".PHP_EOL; - echo '
    '.PHP_EOL; + echo "lang['strselect']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />

    " . PHP_EOL; + echo '' . PHP_EOL; return; } @@ -920,7 +924,7 @@ class TablesController extends BaseController } } - if (0 == sizeof($_POST['show'])) { + if (0 == count($_POST['show'])) { $this->doSelectRows(true, $this->lang['strselectneedscol']); } else { // Generate query SQL @@ -963,9 +967,9 @@ class TablesController extends BaseController $this->coalesceArr($_REQUEST, 'nulls', []); $this->coalesceArr($_REQUEST, 'format', []); - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; if ($attrs->recordCount() > 0) { - echo ''.PHP_EOL; + echo '
    ' . PHP_EOL; // Output table header echo ""; @@ -993,17 +997,17 @@ class TablesController extends BaseController // Continue drawing row $id = (0 == ($i % 2) ? '1' : '2'); - echo "".PHP_EOL; + echo "" . PHP_EOL; echo ''; - echo ''; - echo '".PHP_EOL; + echo '" . PHP_EOL; echo ''.PHP_EOL; - echo ''.PHP_EOL; - ++$i; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + $i++; $attrs->moveNext(); } - echo '
    {$this->lang['strcolumn']}{$this->lang['strtype']}
    ', $this->misc->printVal($attrs->fields['attname']), ''.PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])); echo "fields['attnum']}]\" value=\"", htmlspecialchars($attrs->fields['type']), '" />'.PHP_EOL; - echo "\n' . PHP_EOL; + echo "\n'; // Output null box if the column allows nulls (doesn't look at CHECKs or ASSERTIONS) if (!$attrs->fields['attnotnull']) { @@ -1029,40 +1033,40 @@ class TablesController extends BaseController } else { echo $data->printField("values[{$attrs->fields['attnum']}]", $_REQUEST['values'][$attrs->fields['attnum']], $attrs->fields['type'], ['class' => 'insert_row_input']); } - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; if (!isset($_SESSION['counter'])) { $_SESSION['counter'] = 0; } - echo ''.PHP_EOL; - echo ''.PHP_EOL; - echo ''.PHP_EOL; - echo ''.PHP_EOL; - echo "

    lang['strinsert']}\" />".PHP_EOL; - echo "lang['strinsertandrepeat']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />".PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo "

    lang['strinsert']}\" />" . PHP_EOL; + echo "lang['strinsertandrepeat']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />" . PHP_EOL; if (false !== $fksprops) { if ('default off' != $this->conf['autocomplete']) { - echo "".PHP_EOL; + echo "" . PHP_EOL; } else { - echo "".PHP_EOL; + echo "" . PHP_EOL; } } - echo '

    '.PHP_EOL; + echo '

    ' . PHP_EOL; } else { - echo "

    {$this->lang['strnofieldsforinsert']}

    ".PHP_EOL; - echo "lang['strcancel']}\" />".PHP_EOL; + echo "

    {$this->lang['strnofieldsforinsert']}

    " . PHP_EOL; + echo "lang['strcancel']}\" />" . PHP_EOL; } echo $this->misc->form; - echo '
    '.PHP_EOL; - echo ''; + echo '' . PHP_EOL; + echo ''; } /** @@ -1114,29 +1118,29 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($this->lang['strempty'], 'pg.table.empty'); - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); - echo '

    '.sprintf($this->lang['strconfemptytable'], $this->misc->printVal($a['table'])); + echo '

    ' . sprintf($this->lang['strconfemptytable'], $this->misc->printVal($a['table'])); - echo '

    '.PHP_EOL; + echo '

    ' . PHP_EOL; printf('', htmlspecialchars($a['table'])); } // END mutli empty } else { $this->printTrail('table'); $this->printTitle($this->lang['strempty'], 'pg.table.empty'); - echo '

    ', sprintf($this->lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), '

    '.PHP_EOL; + echo '

    ', sprintf($this->lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), '

    ' . PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; // END not mutli empty } echo " "; - echo ''.PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "lang['strempty']}\" /> lang['strcancel']}\" />".PHP_EOL; + echo "lang['strempty']}\" /> lang['strcancel']}\" />" . PHP_EOL; echo "
    \n"; // END if confirm } else { // Do Empty @@ -1163,7 +1167,7 @@ class TablesController extends BaseController return $this->doDefault($msg); } - return $this->doDefault($sql.'
    '.$this->lang['strtableemptiedbad']); + return $this->doDefault($sql . '
    ' . $this->lang['strtableemptiedbad']); // END not mutli empty } // END do Empty @@ -1189,28 +1193,28 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($this->lang['strdrop'], 'pg.table.drop'); - echo '
    '.PHP_EOL; + echo '' . PHP_EOL; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); - echo '

    ', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($a['table'])), '

    '.PHP_EOL; + echo '

    ', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($a['table'])), '

    ' . PHP_EOL; printf('', htmlspecialchars($a['table'])); } } else { $this->printTrail('table'); $this->printTitle($this->lang['strdrop'], 'pg.table.drop'); - echo '

    ', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), '

    '.PHP_EOL; + echo '

    ', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), '

    ' . PHP_EOL; - echo ''.PHP_EOL; - echo ''.PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; // END if multi drop } - echo ''.PHP_EOL; + echo '' . PHP_EOL; echo $this->misc->form; - echo "

    ".PHP_EOL; - echo "lang['strdrop']}\" />".PHP_EOL; - echo "lang['strcancel']}\" />".PHP_EOL; + echo "

    " . PHP_EOL; + echo "lang['strdrop']}\" />" . PHP_EOL; + echo "lang['strcancel']}\" />" . PHP_EOL; echo "
    \n"; // END confirm } else { //If multi drop diff --git a/src/controllers/TablespacesController.php b/src/controllers/TablespacesController.php index f7d6ce65..f75aa4d0 100644 --- a/src/controllers/TablespacesController.php +++ b/src/controllers/TablespacesController.php @@ -1,15 +1,13 @@ inisizeToBytes(ini_get('upload_max_filesize')); - if (is_double($max_size) && $max_size > 0) { + if (is_float($max_size) && $max_size > 0) { echo '
    '.PHP_EOL; echo ''.PHP_EOL; echo "\t\n\t\t".PHP_EOL; @@ -684,7 +682,7 @@ class TblpropertiesController extends BaseController foreach ($p['keys'] as $k => $c) { if (is_null($p['keys'][$k]['consrc'])) { $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $p['keys'][$k]['indkey'])); - $c['consrc'] = ('u' == $c['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (').join(',', $atts).')'; + $c['consrc'] = ('u' == $c['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (').implode(',', $atts).')'; } if ($c['p_field'] == $s) { diff --git a/src/controllers/TriggersController.php b/src/controllers/TriggersController.php index 8f0004f3..f3c35ae0 100644 --- a/src/controllers/TriggersController.php +++ b/src/controllers/TriggersController.php @@ -1,7 +1,7 @@ \n\t".PHP_EOL; echo "".PHP_EOL; - for ($i = 1; $i < $nbVals; ++$i) { + for ($i = 1; $i < $nbVals; $i++) { echo '".PHP_EOL; } } @@ -434,7 +432,7 @@ class TypesController extends BaseController echo "\t"; echo "".PHP_EOL; - for ($i = 0; $i < $_REQUEST['fields']; ++$i) { + for ($i = 0; $i < $_REQUEST['fields']; $i++) { if (!isset($_REQUEST['field'][$i])) { $_REQUEST['field'][$i] = ''; } @@ -602,7 +600,7 @@ class TypesController extends BaseController echo '
    {$this->lang['strformat']}{$this->lang['strenumvalues']}{$vals[0]['enumval']}
    {$vals[$i]['enumval']}
    {$this->lang['strfield']}{$this->lang['strtype']}{$this->lang['strlength']}{$this->lang['strcomment']}
    '.PHP_EOL; echo "\t".PHP_EOL; - for ($i = 0; $i < $_REQUEST['values']; ++$i) { + for ($i = 0; $i < $_REQUEST['values']; $i++) { if (!isset($_REQUEST['value'][$i])) { $_REQUEST['value'][$i] = ''; } diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index 903bf50f..3a20be61 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -1,7 +1,7 @@ view->offsetGet('in_test'); - - if ($in_test === '1') { - $className = '\PHPPgAdmin\Controller\\' . ucfirst($subject) . 'Controller'; - $controller = new $className($c); - return $controller->render(); - } - - $viewVars = [ - 'url' => '/src/views/' . $subject . ($query_string ? '?' . $query_string : ''), - 'headertemplate' => 'header.twig', - ]; - - return $c->view->render($response, 'iframe_view.twig', $viewVars); -}; // Dumb Polyfill to avoid errors with Kint if ( class_exists('Kint')) { \Kint::$enabled_mode = DEBUGMODE; Kint\Renderer\RichRenderer::$folder = false; - } else { class Kint { - static $enabled_mode = false; - static $aliases = []; + public static $enabled_mode = false; + public static $aliases = []; + public static function dump() {} } } @@ -96,19 +77,19 @@ function ddd(...$v) \Kint::$aliases[] = 'ddd'; // Polyfill for PHPConsole if (isset($conf['php_console']) && - class_exists('PhpConsole\Helper') && + class_exists('\PhpConsole\Helper') && $conf['php_console'] === true) { \PhpConsole\Helper::register(); // it will register global PC class if (!is_null($phpConsoleHandler)) { $phpConsoleHandler->start(); // initialize phpConsoleHandler*/ } - } else { class PC { public static function debug() {} } } +//\PC::dump($phpConsoleHandler); ini_set('display_errors', intval(DEBUGMODE)); ini_set('display_startup_errors', intval(DEBUGMODE)); @@ -121,7 +102,6 @@ if (DEBUGMODE) { list($container, $app) = \PHPPgAdmin\ContainerUtils::createContainer(); if ($container instanceof \Psr\Container\ContainerInterface) { - if (PHP_SAPI == 'cli-server') { $subfolder = '/index.php'; } elseif (isset($conf['subfolder']) && is_string($conf['subfolder'])) { @@ -164,6 +144,7 @@ $container['conf'] = function ($c) use ($conf) { $server['sslmode'] = 'unspecified'; } } + return $conf; }; @@ -175,6 +156,7 @@ $container['lang'] = function ($c) { $container['plugin_manager'] = function ($c) { $plugin_manager = new \PHPPgAdmin\PluginManager($c); + return $plugin_manager; }; @@ -199,6 +181,7 @@ $container['misc'] = function ($c) { $_SESSION['ppaTheme'] = $_theme; $misc->setConf('theme', $_theme); } + return $misc; }; @@ -231,6 +214,7 @@ $container['view'] = function ($c) { $view->offsetSet('appName', $c->get('settings')['appName']); $misc->setView($view); + return $view; }; diff --git a/src/middleware/PopulateRequestResponse.php b/src/middleware/PopulateRequestResponse.php index 97416fa8..47ccd3ea 100644 --- a/src/middleware/PopulateRequestResponse.php +++ b/src/middleware/PopulateRequestResponse.php @@ -4,7 +4,7 @@ namespace PHPPgAdmin\Middleware; /** * Set the requestobj and responseobj properties of the container - * as the value of $request and $response, which already contain the route + * as the value of $request and $response, which already contain the route. */ class PopulateRequestResponse extends Middleware { @@ -15,7 +15,6 @@ class PopulateRequestResponse extends Middleware \Psr\Http\Message\ResponseInterface $response, $next ) { - $container = $this->container; $container['requestobj'] = $request; $container['responseobj'] = $response; @@ -35,7 +34,7 @@ class PopulateRequestResponse extends Middleware $query_string = $request->getUri()->getQuery(); $container->view->offsetSet('query_string', $query_string); - $path = (SUBFOLDER ? (SUBFOLDER . '/') : '') . $request->getUri()->getPath() . ($query_string ? '?' . $query_string : ''); + $path = (SUBFOLDER ? (SUBFOLDER.'/') : '').$request->getUri()->getPath().($query_string ? '?'.$query_string : ''); $container->view->offsetSet('path', $path); $params = $request->getParams(); @@ -68,7 +67,7 @@ class PopulateRequestResponse extends Middleware $messages = $container->flash->getMessages(); if (!empty($messages)) { foreach ($messages as $key => $message) { - \PC::debug($message, 'Flash: ' . $key); + \PC::debug($message, 'Flash: '.$key); } } diff --git a/src/traits/AdminTrait.php b/src/traits/AdminTrait.php index e0a01fac..e301fb7b 100644 --- a/src/traits/AdminTrait.php +++ b/src/traits/AdminTrait.php @@ -1,7 +1,7 @@ conf['max_chars']; + $maxlen = isset($params['cliplen']) && is_int($params['cliplen']) ? $params['cliplen'] : $this->conf['max_chars']; $ellipsis = isset($params['ellipsis']) ? $params['ellipsis'] : $this->lang['strellipsis']; if (strlen($str) > $maxlen) { $str = substr($str, 0, $maxlen - 1).$ellipsis; diff --git a/src/traits/ServersTrait.php b/src/traits/ServersTrait.php index 9ddccc14..2cdcedf7 100644 --- a/src/traits/ServersTrait.php +++ b/src/traits/ServersTrait.php @@ -1,7 +1,7 @@ fields['type'] ), ''; echo ''.PHP_EOL; - ++$i; + $i++; $attrs->moveNext(); } // Select all checkbox @@ -155,7 +155,7 @@ trait ViewsMatviewsTrait } } - if (0 == sizeof($_POST['show'])) { + if (0 == count($_POST['show'])) { return $this->doSelectRows(true, $this->lang['strselectneedscol']); } // Generate query SQL @@ -226,7 +226,7 @@ trait ViewsMatviewsTrait $tmpHsh[$arrTmp['fieldname']] = 1; } elseif ('rename' == $_POST['dblFldMeth']) { // field exist and must be renamed - ++$tmpHsh[$arrTmp['fieldname']]; + $tmpHsh[$arrTmp['fieldname']]++; $selFields .= $field_element.' AS "'.implode('_', $field_arr).'_'.$tmpHsh[$arrTmp['fieldname']].'", '; } // if field already exist, just ignore this one @@ -246,7 +246,7 @@ trait ViewsMatviewsTrait } } // We must perform some magic to make sure that we have a valid join order - $count = sizeof($arrLinks); + $count = count($arrLinks); } return [$arrLinks, $count]; @@ -325,7 +325,7 @@ trait ViewsMatviewsTrait $arrUsedTbls[] = $tbl2; } } - ++$j; + $j++; } //if linkFields has no length then either _POST['formLink'] was not set, or there were no join conditions @@ -375,10 +375,10 @@ trait ViewsMatviewsTrait { $data = $this->misc->getDatabaseAccessor(); - $tblCount = sizeof($_POST['formTables']); + $tblCount = count($_POST['formTables']); $arrSelTables = []; //unserialize our schema/table information and store in arrSelTables - for ($i = 0; $i < $tblCount; ++$i) { + for ($i = 0; $i < $tblCount; $i++) { $arrSelTables[] = unserialize($_POST['formTables'][$i]); } @@ -391,7 +391,7 @@ trait ViewsMatviewsTrait //if we have schemas we need to specify the correct schema for each table we're retrieiving //with getTableAttributes $curSchema = $data->_schema; - for ($i = 0; $i < $tblCount; ++$i) { + for ($i = 0; $i < $tblCount; $i++) { if ($arrSelTables[$i]['schemaname'] != $data->_schema) { $data->setSchema($arrSelTables[$i]['schemaname']); } @@ -442,7 +442,7 @@ trait ViewsMatviewsTrait echo ""; $rowClass = 'data1'; $formLink = []; - for ($i = 0; $i < $linkCount; ++$i) { + for ($i = 0; $i < $linkCount; $i++) { // Initialise variables $this->coalesceArr($formLink[$i], 'operator', 'INNER JOIN'); @@ -478,7 +478,7 @@ trait ViewsMatviewsTrait echo '
    {$this->lang['strvalue']}
    {$this->lang['strviewlink']}
    '.PHP_EOL; echo ""; $rowClass = 'data1'; - for ($i = 0; $i < $linkCount; ++$i) { + for ($i = 0; $i < $linkCount; $i++) { echo "\n'.PHP_EOL; } @@ -316,7 +316,7 @@ class HTMLTableController extends HTMLController $tbody_html .= ''.PHP_EOL; $tabledata->moveNext(); - ++$i; + $i++; } $tbody_html .= ''; @@ -341,7 +341,7 @@ class HTMLTableController extends HTMLController $class = (isset($column['class']) && '' !== $column['class']) ? $column['class'] : ''; - if ($column_id !== 'actions' || sizeof($actions) > 0) { + if ($column_id !== 'actions' || count($actions) > 0) { $tfoot_html .= "".PHP_EOL; } } diff --git a/src/xhtml/TreeController.php b/src/xhtml/TreeController.php index a762295a..e5062072 100644 --- a/src/xhtml/TreeController.php +++ b/src/xhtml/TreeController.php @@ -1,7 +1,7 @@ plugin_manager; - - $treedata = []; - - if ($_treedata->recordCount() > 0) { - while (!$_treedata->EOF) { - $treedata[] = $_treedata->fields; - $_treedata->moveNext(); - } - } - - $tree_params = [ - 'treedata' => &$treedata, - 'attrs' => &$attrs, - 'section' => $section, - ]; - - $plugin_manager->doHook('tree', $tree_params); - - return $this->printTreeJSON($treedata, $attrs, $print); - } - /** * Produce JSON data for the browser tree. * @@ -100,22 +57,30 @@ class TreeController * 'branch' - URL for child nodes (tree JSON) * 'expand' - the action to return JSON for the subtree * 'nodata' - message to display when node has no children - * @param bool $print either to return or echo the result + * @param string $section section of the tree * * @return \Slim\Http\Response|string the json rendered tree */ - private function printTreeJSON(&$treedata, &$attrs, $print = true) + public function printTreeJSON(&$treedata, &$attrs, $section = '') { + $tree_params = [ + 'treedata' => &$treedata, + 'attrs' => &$attrs, + 'section' => $section, + ]; + $plugin_manager = $this->plugin_manager; + $plugin_manager->doHook('tree', $tree_params); + $parent = []; if (isset($attrs['is_root'])) { $parent = [ 'id' => 'root', 'children' => true, - 'icon' => \SUBFOLDER.'/assets/images/themes/default/Servers.png', + 'icon' => \SUBFOLDER . '/assets/images/themes/default/Servers.png', 'state' => ['opened' => true], - 'a_attr' => ['href' => str_replace('//', '/', \SUBFOLDER.'/src/views/servers')], - 'url' => str_replace('//', '/', \SUBFOLDER.'/src/views/servers?action=tree'), + 'a_attr' => ['href' => str_replace('//', '/', \SUBFOLDER . '/src/views/servers')], + 'url' => str_replace('//', '/', \SUBFOLDER . '/src/views/servers?action=tree'), 'text' => 'Servers', ]; } elseif (count($treedata) > 0) { @@ -137,7 +102,7 @@ class TreeController ]; $url = Decorator::get_sanitized_value($attrs['branch'], $rec); if ($url && strpos($url, '/src/views') === false) { - $url = str_replace('//', '/', \SUBFOLDER.'/src/views/'.$url); + $url = str_replace('//', '/', \SUBFOLDER . '/src/views/' . $url); } if ($url) { $tree['url'] = $url; @@ -152,20 +117,17 @@ class TreeController $parent = ['children' => false]; } - if (true === $print) { - if (isset($_REQUEST['children'])) { - $children = $parent; - $parent = ['children' => $children]; - } - - return $this - ->container - ->responseobj - ->withStatus(200) - ->withJson($parent); + if (isset($_REQUEST['children'])) { + $children = $parent; + $parent = ['children' => $children]; } - return $parent; + return $this + ->container + ->responseobj + ->withStatus(200) + ->withJson($parent); + } /** diff --git a/src/xhtml/XHtmlButton.php b/src/xhtml/XHtmlButton.php index 24dabd16..0eed0c8b 100644 --- a/src/xhtml/XHtmlButton.php +++ b/src/xhtml/XHtmlButton.php @@ -1,7 +1,7 @@
    {$this->lang['strviewconditions']}
    ".PHP_EOL; echo \PHPPgAdmin\XHtml\HTMLController::printCombo($arrFields, "formCondition[${i}][field]"); echo \PHPPgAdmin\XHtml\HTMLController::printCombo($arrOperators, "formCondition[${i}][operator]", false, '', false); diff --git a/src/translations/Afrikaans.php b/src/translations/Afrikaans.php index fd11785f..139b162d 100644 --- a/src/translations/Afrikaans.php +++ b/src/translations/Afrikaans.php @@ -1,15 +1,13 @@ misc->getReloadBrowser()) { @@ -59,17 +61,15 @@ class HTMLFooterController extends HTMLController } $this->view->offsetSet('script_footer', ''); + $this->view->offsetSet('inPopUp', $inPopUp); $this->view->offsetSet('reload', $reload_param); $this->view->offsetSet('footer_template', $template); $this->view->offsetSet('print_bottom_link', !$this->_no_bottom_link); - - $footer_html = $this->view->fetch($template); - - if ($doBody) { - echo $footer_html; - } else { - return $footer_html; + foreach ($viewParams as $key => $value) { + $this->view->offsetSet($key, $value); } + return $this->view->fetch($template); + } /** @@ -79,9 +79,9 @@ class HTMLFooterController extends HTMLController */ public function setFocus($object) { - echo ''.PHP_EOL; + echo '' . PHP_EOL; } /** @@ -93,11 +93,11 @@ class HTMLFooterController extends HTMLController */ public function setWindowName($name, $addServer = true) { - echo ''.PHP_EOL; + echo " window.name = '{$name}", ($addServer ? ':' . htmlspecialchars($this->misc->getServerId()) : ''), "';\n"; + echo '//]]>' . PHP_EOL; + echo '' . PHP_EOL; } /** @@ -111,13 +111,11 @@ class HTMLFooterController extends HTMLController * Allows to give some environnement details to plugins. * and 'browse' is the place inside that code (doBrowse). * @param bool $do_print if true, print html, if false, return html - * @param mixed $from can either be null, false or the method calling this one + * @param stromg $from who is calling this method (mostly for debug) */ public function printNavLinks($navlinks, $place, $env, $do_print, $from) { - if (null === $from || false === $from) { - $from = __METHOD__; - } + //$this->prtrace($navlinks); $plugin_manager = $this->plugin_manager; @@ -130,11 +128,9 @@ class HTMLFooterController extends HTMLController $plugin_manager->doHook('navlinks', $plugin_functions_parameters); if (count($navlinks) > 0) { - if ($do_print) { - $this->printLinksList($navlinks, 'navlink', true, $from); - } else { - return $this->printLinksList($navlinks, 'navlink', false, $from); - } + + return $this->printLinksList($navlinks, 'navlink', $do_print, $from); + } } } diff --git a/src/xhtml/HTMLHeaderController.php b/src/xhtml/HTMLHeaderController.php index 5d26b001..6e0d71dd 100644 --- a/src/xhtml/HTMLHeaderController.php +++ b/src/xhtml/HTMLHeaderController.php @@ -1,7 +1,7 @@ 0) { + if (count($actions) > 0) { $thead_html .= ''.$column['title'].'