id_name)) or filters filtered * * @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. */ function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[], $sufix=false, $checked=[]) { static $url = false; // Get the base URL for images if ($url === false) { $url = ui_get_full_url('operation/tree', false, false, false); } // Leaf if (empty($tree['__LEAVES__'])) { return; } $count = 0; $total = (sizeof(array_keys($tree['__LEAVES__'])) - 1); $last_array[$depth] = $last; if ($depth > 0) { echo "
'; if ($return) { return $output; } echo $output; } /** * Print the div that contains the SNMP browser. * * @param bool return The result is printed if set to true or returned if set to false. * @param string width Width of the SNMP browser. Units must be specified. * @param string height Height of the SNMP browser. Units must be specified. * @param string display CSS display value for the container div. Set to none to hide the div. * * @return string The container div. */ function snmp_browser_print_container($return=false, $width='100%', $height='500px', $display='') { // Target selection $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; $table->size = []; $table->data = []; $table->data[0][0] = ''.__('Target IP').' '; $table->data[0][0] .= html_print_input_text('target_ip', '', '', 25, 0, true); $table->data[0][1] = ''.__('Community').' '; $table->data[0][1] .= html_print_input_text('community', '', '', 25, 0, true); $table->data[0][2] = ''.__('Starting OID').' '; $table->data[0][2] .= html_print_input_text('starting_oid', '.1.3.6.1.2', '', 25, 0, true); $table->data[1][0] = ''.__('Version').' '; $table->data[1][0] .= html_print_select( [ '1' => 'v. 1', '2' => 'v. 2', '2c' => 'v. 2c', '3' => 'v. 3', ], 'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, '' ); $servers_to_exec = []; $servers_to_exec[0] = __('Local console'); if (enterprise_installed()) { enterprise_include_once('include/functions_satellite.php'); $rows = get_proxy_servers(); if ($rows !== false) { foreach ($rows as $row) { if ($row['server_type'] != 13) { $s_type = ' (Standard)'; } else { $s_type = ' (Satellite)'; } $servers_to_exec[$row['id_server']] = $row['name'].$s_type; } } } $table->data[1][1] = ''.__('Server to execute').' '; $table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true); $table->data[1][2] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true); // SNMP v3 options $table3 = new stdClass(); $table3->width = '100%'; $table3->valign[0] = ''; $table3->valign[1] = ''; $table3->data[2][1] = ''.__('Auth user').''; $table3->data[2][2] = html_print_input_text('snmp3_browser_auth_user', '', '', 15, 60, true); $table3->data[2][3] = ''.__('Auth password').''; $table3->data[2][4] = html_print_input_password('snmp3_browser_auth_pass', '', '', 15, 60, true); $table3->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_fsb', true); $table3->data[5][0] = ''.__('Privacy method').''; $table3->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_browser_privacy_method', '', '', '', '', true); $table3->data[5][2] = ''.__('Privacy pass').''; $table3->data[5][3] = html_print_input_password('snmp3_browser_privacy_pass', '', '', 15, 60, true); $table3->data[6][0] = ''.__('Auth method').''; $table3->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_browser_auth_method', '', '', '', '', true); $table3->data[6][2] = ''.__('Security level').''; $table3->data[6][3] = html_print_select( [ 'noAuthNoPriv' => __('Not auth and not privacy method'), 'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method'), ], 'snmp3_browser_security_level', '', '', '', '', true ); // Search tools $table2 = new stdClass(); $table2->width = '100%'; $table2->class = 'databox filters'; $table2->size = []; $table2->data = []; $table2->data[0][0] = html_print_input_text('search_text', '', '', 25, 0, true); $table2->data[0][0] .= ''.html_print_image('images/zoom.png', true, ['title' => __('Search'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchText();']).''; $table2->data[0][1] = ' '.''.html_print_image('images/go_first.png', true, ['title' => __('First match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchFirstMatch();']).''; $table2->data[0][1] .= ' '.''.html_print_image('images/go_previous.png', true, ['title' => __('Previous match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchPrevMatch();']).''; $table2->data[0][1] .= ' '.''.html_print_image('images/go_next.png', true, ['title' => __('Next match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchNextMatch();']).''; $table2->data[0][1] .= ' '.''.html_print_image('images/go_last.png', true, ['title' => __('Last match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchLastMatch();']).''; $table2->cellstyle[0][1] = 'text-align:center;'; $table2->data[0][2] = ' '.''.html_print_image( 'images/expand.png', true, [ 'title' => __('Expand the tree (can be slow)'), 'style' => 'vertical-align: middle;', 'onclick' => 'expandAll();', ] ).''; $table2->data[0][2] .= ' '.''.html_print_image('images/collapse.png', true, ['title' => __('Collapse the tree'), 'style' => 'vertical-align: middle;', 'onclick' => 'collapseAll();']).''; $table2->cellstyle[0][2] = 'text-align:center;'; // This extra div that can be handled by jquery's dialog $output = '