diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index f0e07e54e2..812cd16729 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -378,17 +378,10 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf - -
  • + Packages
  • 'IPv4 Address', 'ipv6' => 'IPv6 Address', 'mac' => 'MAC Address', 'arp' => 'ARP Table'); +if( dbFetchCell("SELECT 1 from `packages` LIMIT 1") ) { + $sections['packages'] = 'Packages'; +} + if (!isset($vars['search'])) { $vars['search'] = "ipv4"; } print_optionbar_start('', ''); @@ -30,17 +34,10 @@ unset ($sep); print_optionbar_end('', ''); -switch ($vars['search']) -{ - case 'ipv4': - case 'ipv6': - case 'mac': - case 'arp': - include('pages/search/'.$vars['search'].'.inc.php'); - break; - default: - echo(report_this('Unknown search type '.$vars['search'])); - break; +if( file_exists('pages/search/'.$vars['search'].'.inc.php') ) { + include('pages/search/'.$vars['search'].'.inc.php'); +} else { + echo(report_this('Unknown search type '.$vars['search'])); } ?> diff --git a/html/pages/search/packages.inc.php b/html/pages/search/packages.inc.php new file mode 100644 index 0000000000..20b463d563 --- /dev/null +++ b/html/pages/search/packages.inc.php @@ -0,0 +1,184 @@ + + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + +/** + * Package Search + * @author Daniel Preussker + * @copyright 2014 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Search + */ + +print_optionbar_start(28); +?> +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + 0) { + $results = $_POST['results']; +} else { + $results = 50; +} + +?> +
    + + + + + + + + + + + + +$entry ) { + $vers = array(); + $arch = array(); + $devs = array(); + foreach( $entry as $variation ) { + $variation['version'] = str_replace(":",".",$variation['version']); + if( !in_array($variation['version'], $vers) && (empty($ver) || version_compare($variation['version'],$ver,$opt)) ) { + $vers[] = $variation['version']; + } + if( !in_array($variation['arch'], $arch) ) { + $arch[] = $variation['arch']; + } + if( !in_array($variation['hostname'], $devs) ) { + unset($variation['version']); + $devs[] = generate_device_link($variation); + } + } + if( sizeof($arch) > 0 && sizeof($vers) > 0 ) { + ?> + + + + + + + 0 && $count != $results ) { + ?> + + + + +
    Packages
    PackageVersionArchDevice
    ',$vers); ?>',$arch); ?>',$devs); ?>
    + + + + + +
    +