summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-22 18:48:59 -0200
committerRenato Botelho <renato@netgate.com>2015-10-22 18:48:59 -0200
commita2b0d90982e6d0e2b6e36cf3cf2b258628244ca3 (patch)
treecff98ddcf62e94b4c6d1df69ccec58699953c8bb /src
parentcf093b35443966b7cbf4f466308fa2358cd3cd31 (diff)
downloadpfsense-a2b0d90982e6d0e2b6e36cf3cf2b258628244ca3.zip
pfsense-a2b0d90982e6d0e2b6e36cf3cf2b258628244ca3.tar.gz
Rework the way GUI reads packages tabs, it fixes #5311
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/pkg-utils.inc22
-rw-r--r--src/usr/local/www/guiconfig.inc30
2 files changed, 37 insertions, 15 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index d29691b..447f1ea 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -611,6 +611,28 @@ function read_package_config($package_name) {
return $pkg_info['package'][0];
}
+/* Read package configurationfile and return an array */
+function read_package_configurationfile($package_name) {
+ global $config, $g;
+
+ $pkg_config = array();
+ $id = get_package_id($package_name);
+
+ if ($id < 0 || !isset($config['installedpackages']['package'][$id]['configurationfile'])) {
+ return $pkg_config;
+ }
+
+ $pkg_configurationfile = $config['installedpackages']['package'][$id]['configurationfile'];
+
+ if (empty($pkg_configurationfile) || !file_exists('/usr/local/pkg/' . $pkg_configurationfile)) {
+ return $pkg_config;
+ }
+
+ $pkg_config = parse_xml_config_pkg('/usr/local/pkg/' . $pkg_configurationfile, "packagegui");
+
+ return $pkg_config;
+}
+
function get_after_install_info($package_name) {
$pkg_config = read_package_config($package_name);
diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc
index 969ec46..1dd8ed7 100644
--- a/src/usr/local/www/guiconfig.inc
+++ b/src/usr/local/www/guiconfig.inc
@@ -1098,28 +1098,28 @@ function display_top_tabs(& $tab_array, $no_drop_down = false, $type = 'pills')
<?php endif;
}
-function add_package_tabs($pkgname, &$tab_array) {
+function add_package_tabs($tabgroup, &$tab_array) {
global $config, $g;
-// $pkg = get_pkg_data($pkgname);
-
- if (!isset($pkg['configurationfile']) || !file_exists('/usr/local/pkg/' . $pkg['configurationfile'])) {
+ if (!isset($config['installedpackages']['package'])) {
return;
}
- $pkg_config = parse_xml_config_pkg('/usr/local/pkg/' . $pkg['configurationfile'], "packagegui");
+ foreach ($config['installedpackages']['package'] as $pkg){
+ $pkg_config = read_package_configurationfile($pkg['name']);
- if (!isset($pkg_config['tabs']['tab'])) {
- return;
- }
+ if (!isset($pkg_config['tabs']['tab'])) {
+ continue;
+ }
- foreach ($pkg_config['tabs']['tab'] as $tab) {
- $tab_entry = array();
- if ($tab['name']) {
- $tab_entry[] = $tab['name'];
- $tab_entry[] = false;
- $tab_entry[] = $tab['url'];
- $tab_array[] = $tab_entry;
+ foreach ($pkg_config['tabs']['tab'] as $tab) {
+ $tab_entry = array();
+ if ($tab['name']) {
+ $tab_entry[] = $tab['name'];
+ $tab_entry[] = false;
+ $tab_entry[] = $tab['url'];
+ $tab_array[] = $tab_entry;
+ }
}
}
}
OpenPOWER on IntegriCloud