From 1d403ec2f8daad76a67bb437449aab283c6b48b8 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 24 May 2019 13:42:49 +0200 Subject: [PATCH 1/2] SNMP Browser fix --- .../include/functions_snmp_browser.php | 117 +++++++++++++++--- .../operation/snmpconsole/snmp_browser.php | 22 +++- 2 files changed, 118 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 496a7b747f..d20daecb46 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -41,13 +41,24 @@ $nfdump_date_format = 'Y/m/d.H:i:s'; /** - * Selects all netflow filters (array (id_name => id_name)) or filters filtered + * Generates a Tree with given $tree information. * - * @param tree string SNMP tree returned by snmp_broser_get_tree. - * @param id string Level ID. Do not set, used for recursion. - * @param depth string Branch depth. Do not set, used for recursion. + * Selects all netflow filters (array (id_name => id_name)) or filters filtered + * Used also in Cloud Wizard. + * + * @param string $tree SNMP tree returned by snmp_broser_get_tree. + * @param string $id Level ID. Do not set, used for recursion. + * @param string $depth Branch depth. Do not set, used for recursion. + * @param integer $last Last. + * @param array $last_array Last_array. + * @param string $sufix Sufix. + * @param array $checked Checked. + * @param boolean $descriptive_ids Descriptive_ids. + * @param string $previous_id Previous_id. + * + * @return string HTML code with complete tree. */ -function snmp_browser_print_tree( +function snmp_browser_get_html_tree( $tree, $id=0, $depth=0, @@ -55,7 +66,6 @@ function snmp_browser_print_tree( $last_array=[], $sufix=false, $checked=[], - $return=false, $descriptive_ids=false, $previous_id='' ) { @@ -70,17 +80,17 @@ function snmp_browser_print_tree( // Leaf. if (empty($tree['__LEAVES__'])) { - return; + return ''; } $count = 0; - $total = (sizeof(array_keys($tree['__LEAVES__'])) - 1); + $total = (count(array_keys($tree['__LEAVES__'])) - 1); $last_array[$depth] = $last; if ($depth > 0) { - $output .= "