diff options
-rw-r--r-- | src/etc/inc/pkg-utils.inc | 22 | ||||
-rw-r--r-- | src/usr/local/www/guiconfig.inc | 30 |
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; + } } } } |