diff options
author | ffflabs <amenadiel@gmail.com> | 2020-02-25 21:46:49 +0300 |
---|---|---|
committer | ffflabs <amenadiel@gmail.com> | 2020-02-25 22:13:11 +0300 |
commit | d13d58c4fbfb43538aa2c7ad3f2c52e288808b76 (patch) | |
tree | 712a4116b6717368d6846bc9e2e4ee50af295cd8 /src | |
parent | 4403660c31501c548bd99e5a159b05e84f0808d4 (diff) |
removes usage of plugin manager
removes logic that is now handled in ContainerUtils
moves conf logic out of db folder
removes plugin manager
adds id to results table (will enable handling for wide columns)
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/ContainerUtils.php | 12 | ||||
-rw-r--r-- | src/classes/Misc.php | 64 | ||||
-rw-r--r-- | src/classes/PluginManager.php | 158 | ||||
-rw-r--r-- | src/controllers/BaseController.php | 10 | ||||
-rw-r--r-- | src/controllers/DisplayController.php | 10 | ||||
-rw-r--r-- | src/controllers/ServersController.php | 4 | ||||
-rw-r--r-- | src/database/Postgres10.php | 11 | ||||
-rw-r--r-- | src/database/databasetraits/PrivilegesTrait.php | 2 | ||||
-rw-r--r-- | src/database/databasetraits/SchemaTrait.php | 11 | ||||
-rw-r--r-- | src/database/databasetraits/TableTrait.php | 11 | ||||
-rw-r--r-- | src/xhtml/HTMLController.php | 22 | ||||
-rw-r--r-- | src/xhtml/HTMLFooterController.php | 2 | ||||
-rw-r--r-- | src/xhtml/HTMLHeaderController.php | 5 | ||||
-rw-r--r-- | src/xhtml/HTMLNavbarController.php | 53 | ||||
-rw-r--r-- | src/xhtml/HTMLTableController.php | 4 | ||||
-rw-r--r-- | src/xhtml/TreeController.php | 22 |
16 files changed, 96 insertions, 305 deletions
diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php index 31b870c0..c86e3fc0 100644 --- a/src/classes/ContainerUtils.php +++ b/src/classes/ContainerUtils.php @@ -88,6 +88,18 @@ class ContainerUtils self::$instance = new self(); } + $display_sizes = $conf['display_sizes'] ?? false; + + $conf['display_sizes'] = [ + 'schemas' => (bool) $display_sizes, + 'tables' => (bool) $display_sizes, + ]; + if (is_array($display_sizes)) { + $conf['display_sizes'] = [ + 'schemas' => $display_sizes['schemas'] ?? in_array('schemas', $display_sizes, true), + 'tables' => $display_sizes['tables'] ?? in_array('tables', $display_sizes, true), + ]; + } return [self::$instance->container, self::$instance->app]; } diff --git a/src/classes/Misc.php b/src/classes/Misc.php index 663e898b..d716539c 100644 --- a/src/classes/Misc.php +++ b/src/classes/Misc.php @@ -57,8 +57,8 @@ class Misc $this->conf = $container->get('conf'); //$this->view = $container->get('view'); - $this->plugin_manager = $container->get('plugin_manager'); - $this->appLangFiles = $container->get('appLangFiles'); + + $this->appLangFiles = $container->get('appLangFiles'); $this->appName = $container->get('settings')['appName']; $this->appVersion = $container->get('settings')['appVersion']; @@ -729,49 +729,37 @@ 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'; - } + if (!is_string($icon)) { + return ''; + } + $theme = $this->conf['theme']; + $path = 'assets/images/themes'; + $default_icon = sprintf('%s/%s/default/DisconnectedServer.png', SUBFOLDER, $path); + if (is_readable(sprintf('%s/%s/%s/%s.png', \BASE_PATH, $path, $theme, $icon))) { + return sprintf('%s/%s/%s/%s.png', \SUBFOLDER, $path, $theme, $icon); + } - $path = "/assets/images/themes/default/{$icon}"; - if (file_exists(\BASE_PATH.$path.'.png')) { - return SUBFOLDER.$path.'.png'; - } + if (is_readable(sprintf('%s/%s/%s/%s.gif', \BASE_PATH, $path, $theme, $icon))) { + return sprintf('%s/%s/%s/%s.gif', \SUBFOLDER, $path, $theme, $icon); + } - if (file_exists(\BASE_PATH.$path.'.gif')) { - return SUBFOLDER.$path.'.gif'; - } + if (is_readable(sprintf('%s/%s/%s/%s.ico', \BASE_PATH, $path, $theme, $icon))) { + return sprintf('%s/%s/%s/%s.ico', \SUBFOLDER, $path, $theme, $icon); + } - 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 (is_readable(sprintf('%s/%s/default/%s.png', \BASE_PATH, $path, $icon))) { + return sprintf('%s/%s/default/%s.png', \SUBFOLDER, $path, $icon); + } - if (file_exists(\BASE_PATH.$path.'.gif')) { - return SUBFOLDER.$path.'.gif'; - } + if (is_readable(sprintf('%s/%s/default/%s.gif', \BASE_PATH, $path, $icon))) { + return sprintf('%s/%s/default/%s.gif', \SUBFOLDER, $path, $icon); + } - if (file_exists(\BASE_PATH.$path.'.ico')) { - return SUBFOLDER.$path.'.ico'; - } + if (is_readable(sprintf('%s/%s/default/%s.ico', \BASE_PATH, $path, $icon))) { + return sprintf('%s/%s/default/%s.ico', \SUBFOLDER, $path, $icon); } - return ''; + return $default_icon; } /** diff --git a/src/classes/PluginManager.php b/src/classes/PluginManager.php deleted file mode 100644 index 4d624a1d..00000000 --- a/src/classes/PluginManager.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -/** - * PHPPgAdmin v6.0.0-RC8 - */ - -namespace PHPPgAdmin; - -/** - * @file - * A class that implements the plugin's system - */ - -/** - * A class that implements the plugin's system. - * - * @package PHPPgAdmin - */ -class PluginManager -{ - use \PHPPgAdmin\Traits\HelperTrait; - /** - * Attributes. - */ - private $_plugins_list = []; - private $_available_hooks = [ - 'head', - 'toplinks', - 'tabs', - 'trail', - 'navlinks', - 'actionbuttons', - 'tree', - 'logout', - ]; - private $_actions = []; - private $_hooks = []; - - /** - * Register the plugins. - * - * @internal param $this ->language - Language that have been used - * - * @throws \Interop\Container\Exception\ContainerException - * @throws \Slim\Exception\ContainerValueNotFoundException - */ - public function __construct(\Slim\Container $container) - { - $this->language = $container->has('language') ? $container->get('language') : 'english'; - $this->lang = $container->get('lang'); - $this->conf = $container->get('conf'); - $this->container = $container; - if (!isset($this->conf['plugins'])) { - return; - } - - // Get the activated plugins - $plugins = $this->conf['plugins']; - - foreach ($plugins as $activated_plugin) { - $plugin_file = \BASE_PATH.'/src/plugins/'.$activated_plugin.'/plugin.php'; - - // Verify is the activated plugin exists - if (file_exists($plugin_file)) { - include_once $plugin_file; - - try { - $plugin = new $activated_plugin($this->language); - $this->addPlugin($plugin); - } catch (\Exception $e) { - continue; - } - } else { - $this->halt(sprintf($this->lang['strpluginnotfound']."\t\n", $activated_plugin)); - } - } - } - - /** - * Add a plugin in the list of plugins to manage. - * - * @param mixed $plugin - Instance from plugin - */ - public function addPlugin($plugin) - { - //The $plugin_name is the identification of the plugin. - //Example: PluginExample is the identification for PluginExample - //It will be used to get a specific plugin from the _plugins_list. - $plugin_name = $plugin->get_name(); - $this->_plugins_list[$plugin_name] = $plugin; - - //Register the plugin's functions - $_hooks = $plugin->get__hooks(); - foreach ($_hooks as $hook => $functions) { - if (!in_array($hook, $this->_available_hooks, true)) { - $this->halt(sprintf($this->lang['strhooknotfound']."\t\n", $hook)); - } - $this->_hooks[$hook][$plugin_name] = $functions; - } - - //Register the plugin's _actions - $_actions = $plugin->get__actions(); - $this->_actions[$plugin_name] = $_actions; - } - - public function getPlugin($plugin) - { - if (isset($this->_plugins_list[$plugin])) { - return $this->_plugins_list[$plugin]; - } - - return null; - } - - /** - * Execute the plugins hook functions when needed. - * - * @param string $hook - The place where the function will be called - * @param array $function_args - An array reference with arguments to give to called function - */ - public function doHook($hook, &$function_args) - { - //$this->prtrace('_hooks', $this->_hooks, $function_args); - if (isset($this->_hooks[$hook])) { - foreach ($this->_hooks[$hook] as $plugin_name => $functions) { - $plugin = $this->_plugins_list[$plugin_name]; - foreach ($functions as $function) { - if (method_exists($plugin, $function)) { - call_user_func([$plugin, $function], $function_args); - } - } - } - } - } - - /** - * Execute a plugin's action. - * - * @param string $plugin_name - The plugin name - * @param string $action - action that will be executed - */ - public function do_action($plugin_name, $action) - { - if (!isset($this->_plugins_list[$plugin_name])) { - // Show an error and stop the application - $this->halt(sprintf($this->lang['strpluginnotfound']."\t\n", $plugin_name)); - } - $plugin = $this->_plugins_list[$plugin_name]; - - // Check if the plugin's method exists and if this method is an declared action. - if (method_exists($plugin, $action) and in_array($action, $this->_actions[$plugin_name], true)) { - call_user_func([$plugin, $action]); - } else { - // Show an error and stop the application - $this->halt(sprintf($this->lang['stractionnotfound']."\t\n", $action, $plugin_name)); - } - } -} diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 3a5f792c..8243efe9 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -51,7 +51,7 @@ class BaseController protected $scripts = ''; public $msg = ''; public $view; - public $plugin_manager; + public $misc; public $conf; public $phpMinVer; @@ -72,10 +72,10 @@ class BaseController $this->view_name = str_replace('controller', '', strtolower($this->controller_name)); $this->script = $this->view_name; - $this->view = $container->get('view'); - $this->plugin_manager = $container->get('plugin_manager'); - $this->msg = $container->get('msg'); - $this->appLangFiles = $container->get('appLangFiles'); + $this->view = $container->get('view'); + + $this->msg = $container->get('msg'); + $this->appLangFiles = $container->get('appLangFiles'); $this->misc = $container->get('misc'); $this->conf = $this->misc->getConf(); diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php index 2313d88b..298cc841 100644 --- a/src/controllers/DisplayController.php +++ b/src/controllers/DisplayController.php @@ -20,8 +20,7 @@ class DisplayController extends BaseController */ public function render() { - $this->misc = $this->misc; - $plugin_manager = $this->plugin_manager; + $this->misc = $this->misc; if ('dobrowsefk' == $this->action) { return $this->doBrowseFK(); @@ -443,9 +442,9 @@ class DisplayController extends BaseController private function _getKeyAndActions($resultset, $object, $data, $page, $_gets) { - $key = []; - $strings = $_gets['strings']; - $plugin_manager = $this->plugin_manager; + $key = []; + $strings = $_gets['strings']; + // Fetch unique row identifier, if this is a table browse request. if ($object) { $key = $data->getRowIdentifier($object); @@ -501,7 +500,6 @@ class DisplayController extends BaseController 'actionbuttons' => &$buttons, 'place' => 'display-browse', ]; - $plugin_manager->doHook('actionbuttons', $actions); foreach (array_keys($actions['actionbuttons']) as $action) { $actions['actionbuttons'][$action]['attr']['href']['urlvars'] = array_merge( diff --git a/src/controllers/ServersController.php b/src/controllers/ServersController.php index f5141556..f8eaf69d 100644 --- a/src/controllers/ServersController.php +++ b/src/controllers/ServersController.php @@ -190,10 +190,6 @@ class ServersController extends BaseController public function doLogout() { - $plugin_manager = $this->plugin_manager; - - $plugin_manager->doHook('logout', $_REQUEST['logoutServer']); - $server_info = $this->misc->getServerInfo($_REQUEST['logoutServer']); $this->misc->setServerInfo(null, null, $_REQUEST['logoutServer']); diff --git a/src/database/Postgres10.php b/src/database/Postgres10.php index 50b27662..16bedd29 100644 --- a/src/database/Postgres10.php +++ b/src/database/Postgres10.php @@ -43,16 +43,7 @@ class Postgres10 extends Postgres96 * Either display_sizes is true for tables and schemas, * or we must check if said config is an associative array */ - if (isset($this->conf['display_sizes']) && - ( - $this->conf['display_sizes'] === true || - ( - is_array($this->conf['display_sizes']) && - array_key_exists('tables', $this->conf['display_sizes']) && - $this->conf['display_sizes']['tables'] === true - ) - ) - ) { + if ($this->conf['display_sizes']['tables']) { $sql .= ' pg_size_pretty(pg_total_relation_size(c.oid)) as table_size '; } else { $sql .= " 'N/A' as table_size "; diff --git a/src/database/databasetraits/PrivilegesTrait.php b/src/database/databasetraits/PrivilegesTrait.php index 4b9916b8..9b4864e7 100644 --- a/src/database/databasetraits/PrivilegesTrait.php +++ b/src/database/databasetraits/PrivilegesTrait.php @@ -334,7 +334,7 @@ trait PrivilegesTrait return -1; } - // Dump PUBLIC + // Dump $first = true; $sql .= ($mode == 'GRANT') ? ' TO ' : ' FROM '; if ($public) { diff --git a/src/database/databasetraits/SchemaTrait.php b/src/database/databasetraits/SchemaTrait.php index 78d84c01..ee3d8df2 100644 --- a/src/database/databasetraits/SchemaTrait.php +++ b/src/database/databasetraits/SchemaTrait.php @@ -37,16 +37,7 @@ trait SchemaTrait * Either display_sizes is true for tables and schemas, * or we must check if said config is an associative array */ - if (isset($this->conf['display_sizes']) && - ( - $this->conf['display_sizes'] === true || - ( - is_array($this->conf['display_sizes']) && - array_key_exists('schemas', $this->conf['display_sizes']) && - $this->conf['display_sizes']['schemas'] === true - ) - ) - ) { + if ($this->conf['display_sizes']['tables']) { $sql .= ' pg_size_pretty(SUM(pg_total_relation_size(pg_class.oid))) as schema_size '; } else { $sql .= " 'N/A' as schema_size "; diff --git a/src/database/databasetraits/TableTrait.php b/src/database/databasetraits/TableTrait.php index 3560ca4c..dbdeee64 100644 --- a/src/database/databasetraits/TableTrait.php +++ b/src/database/databasetraits/TableTrait.php @@ -54,16 +54,7 @@ trait TableTrait * Either display_sizes is true for tables and schemas, * or we must check if said config is an associative array */ - if (isset($this->conf['display_sizes']) && - ( - $this->conf['display_sizes'] === true || - ( - is_array($this->conf['display_sizes']) && - array_key_exists('tables', $this->conf['display_sizes']) && - $this->conf['display_sizes']['tables'] === true - ) - ) - ) { + if ($this->conf['display_sizes']['tables']) { $sql .= ' pg_size_pretty(pg_total_relation_size(c.oid)) as table_size '; } else { $sql .= " 'N/A' as table_size "; diff --git a/src/xhtml/HTMLController.php b/src/xhtml/HTMLController.php index 413f5436..28c4d93b 100644 --- a/src/xhtml/HTMLController.php +++ b/src/xhtml/HTMLController.php @@ -26,17 +26,17 @@ class HTMLController // Constructor public function __construct(\Slim\Container $container, $controller_name = null) { - $this->container = $container; - $this->lang = $container->get('lang'); - $this->view = $container->get('view'); - $this->plugin_manager = $container->get('plugin_manager'); - $this->appName = $container->get('settings')['appName']; - $this->appVersion = $container->get('settings')['appVersion']; - $this->appLangFiles = $container->get('appLangFiles'); - $this->misc = $container->get('misc'); - $this->conf = $this->misc->getConf(); - $this->appThemes = $container->get('appThemes'); - $this->action = $container->get('action'); + $this->container = $container; + $this->lang = $container->get('lang'); + $this->view = $container->get('view'); + + $this->appName = $container->get('settings')['appName']; + $this->appVersion = $container->get('settings')['appVersion']; + $this->appLangFiles = $container->get('appLangFiles'); + $this->misc = $container->get('misc'); + $this->conf = $this->misc->getConf(); + $this->appThemes = $container->get('appThemes'); + $this->action = $container->get('action'); if (null !== $controller_name) { $this->controller_name = $controller_name; diff --git a/src/xhtml/HTMLFooterController.php b/src/xhtml/HTMLFooterController.php index 56963864..eaaa1904 100644 --- a/src/xhtml/HTMLFooterController.php +++ b/src/xhtml/HTMLFooterController.php @@ -119,7 +119,6 @@ class HTMLFooterController extends HTMLController $from = __METHOD__; } //$this->prtrace($navlinks); - $plugin_manager = $this->plugin_manager; // Navlinks hook's place $plugin_functions_parameters = [ @@ -127,7 +126,6 @@ class HTMLFooterController extends HTMLController 'place' => $place, 'env' => $env, ]; - $plugin_manager->doHook('navlinks', $plugin_functions_parameters); if (count($navlinks) > 0) { if ($do_print) { diff --git a/src/xhtml/HTMLHeaderController.php b/src/xhtml/HTMLHeaderController.php index c3abdfff..60d50ba6 100644 --- a/src/xhtml/HTMLHeaderController.php +++ b/src/xhtml/HTMLHeaderController.php @@ -45,8 +45,7 @@ class HTMLHeaderController extends HTMLController newrelic_disable_autorum(); } - $lang = $this->lang; - $plugin_manager = $this->plugin_manager; + $lang = $this->lang; $viewVars = []; @@ -62,8 +61,6 @@ class HTMLHeaderController extends HTMLController /*$plugins_head = []; $_params = ['heads' => &$plugins_head]; - $plugin_manager->doHook('head', $_params); - foreach ($plugins_head as $tag) { $header_html .= $tag; }*/ diff --git a/src/xhtml/HTMLNavbarController.php b/src/xhtml/HTMLNavbarController.php index 26deea77..566541df 100644 --- a/src/xhtml/HTMLNavbarController.php +++ b/src/xhtml/HTMLNavbarController.php @@ -51,7 +51,7 @@ class HTMLNavbarController extends HTMLController $dburl = $crumbs['database']['url']; $search_paths = $data->getSearchPath(); foreach ($search_paths as $schema) { - $url = str_replace(['&', 'redirect/database'], ['&', 'redirect/schema'], $dburl . '&schema=' . $schema); + $url = str_replace(['&', 'redirect/database'], ['&', 'redirect/schema'], $dburl.'&schema='.$schema); $destination = $this->container->utils->getDestinationWithLastTab('database'); //$this->dump(['url' => $url, 'destination' => $destination]); $search_path_crumbs[$schema] = [ @@ -77,8 +77,7 @@ class HTMLNavbarController extends HTMLController */ public function printTrail($trail = [], $do_print = true, $from = null) { - $plugin_manager = $this->plugin_manager; - $from = $from ? $from : __METHOD__; + $from = $from ? $from : __METHOD__; $trail_html = $this->printTopbar(false, $from); @@ -90,8 +89,6 @@ class HTMLNavbarController extends HTMLController 'trail' => &$trail, 'section' => $subject, ]; - - $plugin_manager->doHook('trail', $plugin_functions_parameters); } $crumbs = $this->_getCrumbs($trail); @@ -158,7 +155,7 @@ class HTMLNavbarController extends HTMLController //$this->prtrace($tabs); if (count($tabs) > 0) { - $width = (int) (100 / count($tabs)) . '%'; + $width = (int) (100 / count($tabs)).'%'; $viewVars = [ 'width' => $width, @@ -188,26 +185,26 @@ class HTMLNavbarController extends HTMLController { $from = $from ? $from : __METHOD__; - $lang = $this->lang; - $plugin_manager = $this->plugin_manager; - $this->misc = $this->misc; - $appName = $this->misc->appName; - $appVersion = $this->misc->appVersion; + $lang = $this->lang; + + $this->misc = $this->misc; + $appName = $this->misc->appName; + $appVersion = $this->misc->appVersion; $server_info = $this->misc->getServerInfo(); $server_id = $this->misc->getServerId(); $reqvars = $this->misc->getRequestVars('table'); - $topbar_html = '<div class="topbar" data-controller="' . $this->controller_name . '"><table style="width: 100%"><tr><td>'; + $topbar_html = '<div class="topbar" data-controller="'.$this->controller_name.'"><table style="width: 100%"><tr><td>'; if ($server_info && isset($server_info['platform'], $server_info['username'])) { // top left informations when connected $topbar_html .= sprintf( $lang['strtopbar'], - '<span class="platform">' . htmlspecialchars($server_info['platform']) . '</span>', - '<span class="host">' . htmlspecialchars((empty($server_info['host'])) ? 'localhost' : $server_info['host']) . '</span>', - '<span class="port">' . htmlspecialchars($server_info['port']) . '</span>', - '<span class="username">' . htmlspecialchars($server_info['username']) . '</span>' + '<span class="platform">'.htmlspecialchars($server_info['platform']).'</span>', + '<span class="host">'.htmlspecialchars((empty($server_info['host'])) ? 'localhost' : $server_info['host']).'</span>', + '<span class="port">'.htmlspecialchars($server_info['port']).'</span>', + '<span class="username">'.htmlspecialchars($server_info['username']).'</span>' ); $topbar_html .= '</td>'; @@ -218,7 +215,7 @@ class HTMLNavbarController extends HTMLController 'sql' => [ 'attr' => [ 'href' => [ - 'url' => SUBFOLDER . '/src/views/sqledit', + 'url' => SUBFOLDER.'/src/views/sqledit', 'urlvars' => array_merge($reqvars, [ 'action' => 'sql', ]), @@ -232,7 +229,7 @@ class HTMLNavbarController extends HTMLController 'history' => [ 'attr' => [ 'href' => [ - 'url' => SUBFOLDER . '/src/views/history', + 'url' => SUBFOLDER.'/src/views/history', 'urlvars' => array_merge($reqvars, [ 'action' => 'pophistory', ]), @@ -245,7 +242,7 @@ class HTMLNavbarController extends HTMLController 'find' => [ 'attr' => [ 'href' => [ - 'url' => SUBFOLDER . '/src/views/sqledit', + 'url' => SUBFOLDER.'/src/views/sqledit', 'urlvars' => array_merge($reqvars, [ 'action' => 'find', ]), @@ -259,7 +256,7 @@ class HTMLNavbarController extends HTMLController 'logout' => [ 'attr' => [ 'href' => [ - 'url' => SUBFOLDER . '/src/views/servers', + 'url' => SUBFOLDER.'/src/views/servers', 'urlvars' => [ 'action' => 'logout', 'logoutServer' => sha1("{$server_info['host']}:{$server_info['port']}:{$server_info['sslmode']}"), @@ -276,8 +273,6 @@ class HTMLNavbarController extends HTMLController 'toplinks' => &$toplinks, ]; - $plugin_manager->doHook('toplinks', $plugin_functions_parameters); - $topbar_html .= '<td style="text-align: right">'; $topbar_html .= $this->printLinksList($toplinks, 'toplink', false, $from); @@ -287,7 +282,7 @@ class HTMLNavbarController extends HTMLController $topbar_html .= "<span class=\"appname\">{$appName}</span> <span class=\"version\">{$appVersion}</span>"; } - $topbar_html .= '</tr></table></div>' . PHP_EOL; + $topbar_html .= '</tr></table></div>'.PHP_EOL; if ($do_print) { echo $topbar_html; @@ -301,7 +296,7 @@ class HTMLNavbarController extends HTMLController $vars = $this->misc->getSubjectParams($subject); ksort($vars['params']); - return "{$vars['url']}?" . http_build_query($vars['params'], '', '&'); + return "{$vars['url']}?".http_build_query($vars['params'], '', '&'); } /** @@ -321,7 +316,7 @@ class HTMLNavbarController extends HTMLController $trail['root'] = [ 'text' => $appName, - 'url' => SUBFOLDER . '/src/views/servers', + 'url' => SUBFOLDER.'/src/views/servers', 'icon' => 'Introduction', ]; @@ -391,7 +386,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'View', ], 'matview' => [ - 'title' => 'M' . $lang['strview'], + 'title' => 'M'.$lang['strview'], 'subject' => 'matview', 'help' => 'pg.matview', 'icon' => 'MViews', @@ -445,7 +440,7 @@ class HTMLNavbarController extends HTMLController switch ($subject) { case 'function': $trail[$subject] = [ - 'title' => $lang['str' . $subject], + 'title' => $lang['str'.$subject], 'text' => $_REQUEST[$subject], 'url' => $this->getHREFSubject('function'), 'help' => 'pg.function', @@ -501,9 +496,9 @@ class HTMLNavbarController extends HTMLController break; } $trail[$subject] = [ - 'title' => array_key_exists('str' . $subject, $lang) ? $lang['str' . $subject] : $subject, + 'title' => array_key_exists('str'.$subject, $lang) ? $lang['str'.$subject] : $subject, 'text' => $_REQUEST[$subject], - 'help' => 'pg.' . $subject, + 'help' => 'pg.'.$subject, 'icon' => $icon, ]; } diff --git a/src/xhtml/HTMLTableController.php b/src/xhtml/HTMLTableController.php index 53638596..1ed9d66d 100644 --- a/src/xhtml/HTMLTableController.php +++ b/src/xhtml/HTMLTableController.php @@ -91,10 +91,6 @@ class HTMLTableController extends HTMLController public function printTable($turn_into_datatable = true, $with_body = true) { - $plugin_manager = $this->plugin_manager; - - $plugin_manager->doHook('actionbuttons', $this->plugin_functions_parameters); - if ($this->tabledata->recordCount() <= 0) { return "<p>{$this->nodata}</p>".PHP_EOL; } diff --git a/src/xhtml/TreeController.php b/src/xhtml/TreeController.php index c727f34c..c524c75b 100644 --- a/src/xhtml/TreeController.php +++ b/src/xhtml/TreeController.php @@ -29,15 +29,15 @@ class TreeController $this->container = $container; $this->lang = $container->get('lang'); //$this->conf = $container->get('conf'); - $this->view = $container->get('view'); - $this->plugin_manager = $container->get('plugin_manager'); - $this->appName = $container->get('settings')['appName']; - $this->appVersion = $container->get('settings')['appVersion']; - $this->appLangFiles = $container->get('appLangFiles'); - $this->misc = $container->get('misc'); - $this->conf = $this->misc->getConf(); - $this->appThemes = $container->get('appThemes'); - $this->action = $container->get('action'); + $this->view = $container->get('view'); + + $this->appName = $container->get('settings')['appName']; + $this->appVersion = $container->get('settings')['appVersion']; + $this->appLangFiles = $container->get('appLangFiles'); + $this->misc = $container->get('misc'); + $this->conf = $this->misc->getConf(); + $this->appThemes = $container->get('appThemes'); + $this->action = $container->get('action'); if (null !== $controller_name) { $this->controller_name = $controller_name; } @@ -64,8 +64,6 @@ class TreeController */ public function printTree(&$_treedata, &$attrs, $section, $print = true) { - $plugin_manager = $this->plugin_manager; - $treedata = []; if ($_treedata->recordCount() > 0) { @@ -81,8 +79,6 @@ class TreeController 'section' => $section, ]; - $plugin_manager->doHook('tree', $tree_params); - return $this->printTreeJSON($treedata, $attrs, $print); } |