diff --git a/AUTHORS.md b/AUTHORS.md index 1aa5c18ff..acd9aa26f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -83,6 +83,9 @@ LibreNMS contributors: - Maximilian Wilhelm (BarbarossaTM) - Jameson Finney (JamesonFinney) - John Wells (jbwiv) +- Henoc Khouilla (henocKA) +- Paul Blasquez (pblasquez) +- Paul Heinrichs (pheinrichs) [1]: http://observium.org/ "Observium web site" Observium was written by: diff --git a/alerts.php b/alerts.php index 6d791d213..1035214c0 100755 --- a/alerts.php +++ b/alerts.php @@ -182,7 +182,7 @@ function RunFollowUp() { } $alert['details'] = json_decode(gzuncompress($alert['details']), true); - $rextra = json_decode($alert['extra'], true); + $rextra = json_decode(htmlspecialchars_decode($alert['extra']), true); if ($rextra['invert']) { continue; } @@ -237,7 +237,7 @@ function RunAlerts() { $noiss = false; $noacc = false; $updet = false; - $rextra = json_decode($alert['extra'], true); + $rextra = json_decode(htmlspecialchars_decode($alert['extra']), true); $chk = dbFetchRow('SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id = ? && devices.device_id = alerts.device_id && alerts.rule_id = ?', array($alert['device_id'], $alert['rule_id'])); if ($chk['alerted'] == $alert['state']) { $noiss = true; diff --git a/doc/Extensions/Component.md b/doc/Extensions/Component.md index 40331981d..5fcf3838f 100644 --- a/doc/Extensions/Component.md +++ b/doc/Extensions/Component.md @@ -307,11 +307,11 @@ To see an example of how the component module can used, please see the following - Cisco CBQoS - includes/discovery/cisco-cbqos.inc.php - - includes/poller/cisco-cbqos.inc.php + - includes/polling/cisco-cbqos.inc.php - html/includes/graphs/device/cbqos_traffic.inc.php - Cisco OTV - includes/discovery/cisco-otv.inc.php - - includes/poller/applications/cisco-otv.inc.php + - includes/polling/cisco-otv.inc.php - html/includes/graphs/device/cisco-otv-mac.inc.php - - html/pages/device/apps/cisco-otv.inc.php + - html/pages/routing/cisco-otv.inc.php diff --git a/doc/Extensions/Oxidized.md b/doc/Extensions/Oxidized.md index e74bf5c3c..9123c2ed8 100644 --- a/doc/Extensions/Oxidized.md +++ b/doc/Extensions/Oxidized.md @@ -12,14 +12,13 @@ $config['oxidized']['enabled'] = TRUE; $config['oxidized']['url'] = 'http://127.0.0.1:8888'; ``` -We also support config versioning within Oxidized, this will allow you to see the old configs stored. - +LibreNMS supports config versioning if Oxidized does. This is known to work with the git output module. ```php $config['oxidized']['features']['versioning'] = true; ``` Oxidized supports various ways to utilise credentials to login to devices, you can specify global username/password within Oxidized, Group level username/password or per device. -We currently support sending groups back to Oxidized so that you can then define group credentials within Oxidized. To enable this support please switch on 'Enable the return of groups to Oxidized': +LibreNMS currently supports sending groups back to Oxidized so that you can then define group credentials within Oxidized. To enable this support please switch on 'Enable the return of groups to Oxidized': ```php $config['oxidized']['group_support'] = true; @@ -35,7 +34,7 @@ $config['oxidized']['default_group'] = 'default'; Oxidized has support for feeding devices into it via an API call, support for Oxidized has been added to the LibreNMS API. A sample config for Oxidized is provided below. -You will need to configure default credentials for your devices, LibreNMS doesn't provide login credentials at this time. +You will need to configure default credentials for your devices in the Oxidized config, LibreNMS doesn't provide login credentials at this time. ```bash source: @@ -61,7 +60,7 @@ $config['oxidized']['reload_nodes'] = TRUE; ``` -### Using Groups +#### Using Groups To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted. The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php: @@ -80,7 +79,7 @@ groups: password: ``` -### Miscellaneous +#### Miscellaneous If you have devices which you do not wish to appear in Oxidized then you can edit those devices in Device -> Edit -> Misc and enable "Exclude from Oxidized?" diff --git a/doc/General/Acknowledgement.md b/doc/General/Acknowledgement.md index 328a8f867..dca40023e 100644 --- a/doc/General/Acknowledgement.md +++ b/doc/General/Acknowledgement.md @@ -24,6 +24,7 @@ LibreNMS 3rd party acknowledgements - TW Sack (https://code.google.com/p/tw-sack/): GPLv3 - Gridster (http://gridster.net/): MIT - Pure PHP radius class (http://developer.sysco.ch/php/): GPLv3 + - GeSHi - Generic Syntax Highlighter (http://qbnz.com/highlighter/): GPLv2+ #### 3rd Party GPLv3 Non-compliant diff --git a/doc/Installation/Installation-(Debian-Ubuntu).md b/doc/Installation/Installation-(Debian-Ubuntu).md index e07ac9bd2..dea55fb1f 100644 --- a/doc/Installation/Installation-(Debian-Ubuntu).md +++ b/doc/Installation/Installation-(Debian-Ubuntu).md @@ -73,7 +73,7 @@ Adding the above line to `/etc/snmp/snmpd.conf` and running `service snmpd resta In `/etc/php5/apache2/php.ini` and `/etc/php5/cli/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC". -Please also ensure that allow_url_fopen is enabled. +Please also ensure that `allow_url_fopen` is enabled. Other functions needed for LibreNMS include `exec,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,popen`. ### Adding the librenms-user ### diff --git a/doc/Installation/Installation-(RHEL-CentOS).md b/doc/Installation/Installation-(RHEL-CentOS).md index 46100d078..d60fe96af 100644 --- a/doc/Installation/Installation-(RHEL-CentOS).md +++ b/doc/Installation/Installation-(RHEL-CentOS).md @@ -135,7 +135,8 @@ You need to configure snmpd appropriately if you have not already done so. An a Adding the above line to `/etc/snmp/snmpd.conf` and running `service snmpd restart` will activate this config. In `/etc/php.ini`, ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid -examples are: "America/New York", "Australia/Brisbane", "Etc/UTC". Please also ensure that allow_url_fopen is enabled. +examples are: "America/New York", "Australia/Brisbane", "Etc/UTC". +Please also ensure that `allow_url_fopen` is enabled. Other functions needed for LibreNMS include `exec,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,popen`. Next, add the following to `/etc/httpd/conf.d/librenms.conf` diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index f37f7bc78..8070df0ce 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -379,10 +379,15 @@ NFSen integration support. #### Location mapping +Exact Matching: ```php $config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK"; ``` -The above is an example, this will rewrite basic snmp locations so you don't need to configure full location within snmp. +Regex Matching: +```php +$config['location_map']['/Sink/'] = "Under The Sink, The Office, London, UK"; +``` +The above are examples, these will rewrite device snmp locations so you don't need to configure full location within snmp. #### Interfaces to be ignored diff --git a/doc/Support/FAQ.md b/doc/Support/FAQ.md index 8f9147e88..bdcfc73ca 100644 --- a/doc/Support/FAQ.md +++ b/doc/Support/FAQ.md @@ -73,6 +73,8 @@ If the page you are trying to load has a substantial amount of data in it then i This is usually due to there being blank spaces outside of the `` php tags within config.php. Remove these and retry. It's also worth removing the final `?>` at the end of config.php as this is not required. +Another reason why it might not be working is if you disabled functions needed by LibreNMS, which include `allow_url_fopen` +and `exec,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,popen`. #### How do I debug pages not loading correctly? diff --git a/html/ajax_dash.php b/html/ajax_dash.php index 0ffc58067..e5622c732 100644 --- a/html/ajax_dash.php +++ b/html/ajax_dash.php @@ -39,7 +39,7 @@ elseif (is_file('includes/common/'.$type.'.inc.php')) { $title = ucfirst($type); $unique_id = str_replace(array("-","."),"_",uniqid($type,true)); $widget_id = mres($_POST['id']); - $widget_settings = json_decode(dbFetchCell('select settings from users_widgets where user_widget_id = ?',array($widget_id)),true); + $widget_settings = json_decode(htmlspecialchars_decode(dbFetchCell('select settings from users_widgets where user_widget_id = ?',array($widget_id))),true); $widget_dimensions = $_POST['dimensions']; if( !empty($_POST['settings']) ) { define('show_settings',true); diff --git a/html/ajax_setresolution.php b/html/ajax_setresolution.php index b72bd748e..413832fb7 100644 --- a/html/ajax_setresolution.php +++ b/html/ajax_setresolution.php @@ -4,5 +4,6 @@ if(isset($_REQUEST['width']) AND isset($_REQUEST['height'])) { $_SESSION['screen_width'] = $_REQUEST['width']; $_SESSION['screen_height'] = $_REQUEST['height']; } +header('Content-type: text/plain'); echo $_SESSION['screen_width']; echo $_SESSION['screen_height']; diff --git a/html/images/os/calix.png b/html/images/os/calix.png new file mode 100644 index 000000000..156c0f853 Binary files /dev/null and b/html/images/os/calix.png differ diff --git a/html/includes/common/availability-map.inc.php b/html/includes/common/availability-map.inc.php index 2fc72a090..401ed7bfc 100644 --- a/html/includes/common/availability-map.inc.php +++ b/html/includes/common/availability-map.inc.php @@ -53,7 +53,7 @@ else { foreach(dbFetchRows($sql, $param) as $device) { if ($device['status'] == '1') { $btn_type = 'btn-success'; - if ($device['uptime'] < $config['uptime_warning']) { + if (($device['uptime'] < $config['uptime_warning']) && ($device['uptime'] != '0')) { $btn_type = 'btn-warning'; $c++; } diff --git a/html/includes/dev-overview-data.inc.php b/html/includes/dev-overview-data.inc.php index 04c4de3dd..defeb6d44 100644 --- a/html/includes/dev-overview-data.inc.php +++ b/html/includes/dev-overview-data.inc.php @@ -68,14 +68,14 @@ if ($device['sysContact']) { Contact'; if (get_dev_attrib($device, 'override_sysContact_bool')) { echo ' - '.htmlspecialchars(get_dev_attrib($device, 'override_sysContact_string')).' + '.get_dev_attrib($device, 'override_sysContact_string').' SNMP Contact'; } echo ' - '.htmlspecialchars($device['sysContact']).' + '.$device['sysContact'].' '; } diff --git a/html/includes/geshi/geshi/diff.php b/html/includes/geshi/geshi/diff.php new file mode 100644 index 000000000..e4bfc6f47 --- /dev/null +++ b/html/includes/geshi/geshi/diff.php @@ -0,0 +1,194 @@ + 'Diff', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array(), + 'ESCAPE_CHAR' => ' ', + 'KEYWORDS' => array( + 1 => array( + '\ No newline at end of file' + ), +// 2 => array( +// '***************' /* This only seems to works in some cases? */ +// ), + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + 1 => false, +// 2 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #aaaaaa; font-style: italic;', +// 2 => 'color: #dd6611;', + ), + 'COMMENTS' => array( + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => '' + ), + 'STRINGS' => array( + 0 => '' + ), + 'NUMBERS' => array( + 0 => '' + ), + 'METHODS' => array( + 0 => '' + ), + 'SYMBOLS' => array( + 0 => '' + ), + 'SCRIPT' => array( + 0 => '' + ), + 'REGEXPS' => array( + 0 => 'color: #440088;', + 1 => 'color: #991111;', + 2 => 'color: #00b000;', + 3 => 'color: #888822;', + 4 => 'color: #888822;', + 5 => 'color: #0011dd;', + 6 => 'color: #440088;', + 7 => 'color: #991111;', + 8 => 'color: #00b000;', + 9 => 'color: #888822;', + ), + ), + 'URLS' => array( + 1 => '', +// 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array(), + 'REGEXPS' => array( + 0 => "[0-9,]+[acd][0-9,]+", + //Removed lines + 1 => array( + GESHI_SEARCH => '(^|(?<=\A\s))\\<.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Inserted lines + 2 => array( + GESHI_SEARCH => '(^|(?<=\A\s))\\>.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Location line + 3 => array( + GESHI_SEARCH => '(^|(?<=\A\s))-{3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Inserted line + 4 => array( + GESHI_SEARCH => '(^|(?<=\A\s))(\\+){3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Modified line + 5 => array( + GESHI_SEARCH => '(^|(?<=\A\s))\\!.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //File specification + 6 => array( + GESHI_SEARCH => '(^|(?<=\A\s))[\\@]{2}.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Removed line + 7 => array( + GESHI_SEARCH => '(^|(?<=\A\s))\\-.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //Inserted line + 8 => array( + GESHI_SEARCH => '(^|(?<=\A\s))\\+.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + //File specification + 9 => array( + GESHI_SEARCH => '(^|(?<=\A\s))(\\*){3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); diff --git a/html/includes/graphs/device/cisco-otv-mac.inc.php b/html/includes/graphs/device/cisco-otv-mac.inc.php new file mode 100644 index 000000000..691bfd10d --- /dev/null +++ b/html/includes/graphs/device/cisco-otv-mac.inc.php @@ -0,0 +1,62 @@ + + * + * 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. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options['filter']['type'] = array('=','Cisco-OTV'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'MAC Addresses Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + if ($array['otvtype'] == 'endpoint') { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$array['endpoint']."-mac.rrd"); + + if (file_exists($rrd_filename)) { + // Stack the area on the second and subsequent DS's + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; + } + + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } + else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE "; + $rrd_additions .= " AREA:DS" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['endpoint'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%4.0lf%s\\\l "; + $count++; + } + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} +else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/graphs/device/cisco-otv-vlan.inc.php b/html/includes/graphs/device/cisco-otv-vlan.inc.php new file mode 100644 index 000000000..1116e056c --- /dev/null +++ b/html/includes/graphs/device/cisco-otv-vlan.inc.php @@ -0,0 +1,62 @@ + + * + * 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. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options['filter']['type'] = array('=','Cisco-OTV'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'VLANs Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + if ($array['otvtype'] == 'overlay') { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$array['label']."-vlan.rrd"); + + if (file_exists($rrd_filename)) { + // Stack the area on the second and subsequent DS's + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; + } + + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } + else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE "; + $rrd_additions .= " AREA:DS" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%4.0lf%s\\\l "; + $count++; + } + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} +else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/print-alert-rules.php b/html/includes/print-alert-rules.php index eac1ae6fd..4a198d9a1 100644 --- a/html/includes/print-alert-rules.php +++ b/html/includes/print-alert-rules.php @@ -205,7 +205,7 @@ foreach (dbFetchRows($full_query, $param) as $rule) { echo 'Inverted '; } - echo ''.htmlentities($rule['rule']).''; + echo ''.$rule['rule'].''; echo ''.$rule['severity'].''; echo " "; if ($rule_extra['mute'] === true) { diff --git a/html/includes/print-alerts.inc.php b/html/includes/print-alerts.inc.php index d9758a0f3..ac75278fb 100644 --- a/html/includes/print-alerts.inc.php +++ b/html/includes/print-alerts.inc.php @@ -15,7 +15,7 @@ if (!isset($alert_entry['device'])) { '; } -echo ''.htmlspecialchars($alert_entry['name']).''; +echo ''.$alert_entry['name'].''; if ($alert_state != '') { if ($alert_state == '0') { diff --git a/html/includes/print-event-short.inc.php b/html/includes/print-event-short.inc.php index 42fc75768..2c02b7727 100644 --- a/html/includes/print-event-short.inc.php +++ b/html/includes/print-event-short.inc.php @@ -25,6 +25,6 @@ if ($entry['type'] == 'interface') { $entry['link'] = ''.generate_port_link(getifbyid($entry['reference'])).''; } - echo $entry['link'].' '.htmlspecialchars($entry['message']).' + echo $entry['link'].' '.$entry['message'].' '; diff --git a/html/includes/print-event.inc.php b/html/includes/print-event.inc.php index d8afd6bfa..14b6764d8 100644 --- a/html/includes/print-event.inc.php +++ b/html/includes/print-event.inc.php @@ -31,5 +31,5 @@ else { echo ''.$entry['link'].''; -echo ''.htmlspecialchars($entry['message']).' +echo ''.$entry['message'].' '; diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 74ae6f7a1..4c22ad08b 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -420,7 +420,13 @@ $routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_ $routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`"); $routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`"); -if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf']+$routing_count['cef']+$routing_count['vrf']) > "0") { +require_once "../includes/component.php"; +$component = new component(); +$options['type'] = 'Cisco-OTV'; +$otv = $component->getComponents(null,$options); +$routing_count['cisco-otv'] = count($otv); + +if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf']+$routing_count['cef']+$routing_count['vrf']+$routing_count['cisco-otv']) > "0") { ?> '); + $separator = 0; + } + echo('
  • Cisco OTV
  • '); + $separator++; + } + // BGP Sessions if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp']) { if ($separator) { diff --git a/html/includes/print-syslog.inc.php b/html/includes/print-syslog.inc.php index 0f1c1c669..26a0d5b62 100644 --- a/html/includes/print-syslog.inc.php +++ b/html/includes/print-syslog.inc.php @@ -8,10 +8,10 @@ if (device_permitted($entry['device_id'])) { if ($vars['page'] != 'device') { $syslog_output .= ''.$entry['date'].' '.generate_device_link($entry).' - '.$entry['program'].' : '.htmlspecialchars($entry['msg']).''; + '.$entry['program'].' : '.$entry['msg'].''; } else { - $syslog_output .= ''.$entry['date'].'   '.$entry['program'].'   '.htmlspecialchars($entry['msg']).''; + $syslog_output .= ''.$entry['date'].'   '.$entry['program'].'   '.$entry['msg'].''; } $syslog_output .= ''; diff --git a/html/includes/reports/alert-log.pdf.inc.php b/html/includes/reports/alert-log.pdf.inc.php index d293b474b..13b13526d 100644 --- a/html/includes/reports/alert-log.pdf.inc.php +++ b/html/includes/reports/alert-log.pdf.inc.php @@ -66,7 +66,7 @@ foreach (dbFetchRows($full_query, $param) as $alert_entry) { $data[] = array( $alert_entry['time_logged'], $hostname, - htmlspecialchars($alert_entry['name']), + $alert_entry['name'], $text, ); }//end if diff --git a/html/includes/table/alertlog.inc.php b/html/includes/table/alertlog.inc.php index 8b4d94d3e..3c41acb78 100644 --- a/html/includes/table/alertlog.inc.php +++ b/html/includes/table/alertlog.inc.php @@ -77,7 +77,7 @@ foreach (dbFetchRows($sql, $param) as $alertlog) { 'time_logged' => $alertlog['humandate'], 'details' => '', 'hostname' => '
    '.generate_device_link($dev, shorthost($dev['hostname'])).'
    '.$fault_detail.'
    ', - 'alert' => htmlspecialchars($alertlog['alert']), + 'alert' => $alertlog['alert'], 'status' => " $text", ); }//end foreach diff --git a/html/includes/table/eventlog.inc.php b/html/includes/table/eventlog.inc.php index 62edbbefd..6390b0d0f 100644 --- a/html/includes/table/eventlog.inc.php +++ b/html/includes/table/eventlog.inc.php @@ -66,7 +66,7 @@ foreach (dbFetchRows($sql, $param) as $eventlog) { 'datetime' => $eventlog['humandate'], 'hostname' => generate_device_link($dev, shorthost($dev['hostname'])), 'type' => $type, - 'message' => htmlspecialchars($eventlog['message']), + 'message' => $eventlog['message'], ); } diff --git a/html/includes/table/sensors.inc.php b/html/includes/table/sensors.inc.php index 62fd73b64..5bf964193 100644 --- a/html/includes/table/sensors.inc.php +++ b/html/includes/table/sensors.inc.php @@ -47,7 +47,7 @@ if ($rowCount != -1) { $sql = "SELECT * $sql"; foreach (dbFetchRows($sql, $param) as $sensor) { - if (empty($sensor['sensor_current'])) { + if (!isset($sensor['sensor_current'])) { $sensor['sensor_current'] = 'NaN'; } else { diff --git a/html/includes/table/syslog.inc.php b/html/includes/table/syslog.inc.php index 987aac65a..bd80e7b5f 100644 --- a/html/includes/table/syslog.inc.php +++ b/html/includes/table/syslog.inc.php @@ -66,7 +66,7 @@ foreach (dbFetchRows($sql, $param) as $syslog) { 'timestamp' => $syslog['date'], 'device_id' => generate_device_link($dev, shorthost($dev['hostname'])), 'program' => $syslog['program'], - 'msg' => htmlspecialchars($syslog['msg']), + 'msg' => $syslog['msg'], ); } diff --git a/html/includes/vars.inc.php b/html/includes/vars.inc.php index 369a13a74..3326a119f 100644 --- a/html/includes/vars.inc.php +++ b/html/includes/vars.inc.php @@ -43,3 +43,6 @@ foreach ($_GET as $name => $value) { foreach ($_POST as $name => $value) { $vars[$name] = $value; } + +array_walk_recursive($vars,'sanitize_array'); +reset($vars); diff --git a/html/index.php b/html/index.php index 46164c663..494d6c3de 100644 --- a/html/index.php +++ b/html/index.php @@ -214,14 +214,6 @@ else {
    "); - print_r($_GET); - print_r($vars); - echo(""); -} - if ($_SESSION['authenticated']) { // Authenticated. Print a page. if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file("pages/" . $vars['page'] . ".inc.php")) { diff --git a/html/js/librenms.js b/html/js/librenms.js index b91090761..f103ea29b 100644 --- a/html/js/librenms.js +++ b/html/js/librenms.js @@ -223,3 +223,24 @@ $(document).on("click", '.collapse-neighbors', function(event) list.toggle(); continued.toggle(); }); + + +$(document).ready(function() { + var lines = 'on'; + $("#linenumbers").button().click(function() { + if (lines == 'on') { + $($('.config').find('ol').get().reverse()).each(function(){ + $(this).replaceWith($('
      '+$(this).html()+'
    ')) + lines = 'off'; + $('#linenumbers').val('Show line numbers'); + }); + } + else { + $($('.config').find('ul').get().reverse()).each(function(){ + $(this).replaceWith($('
      '+$(this).html()+'
    ')); + lines = 'on'; + $('#linenumbers').val('Hide line numbers'); + }); + } + }); +}); diff --git a/html/pages/adduser.inc.php b/html/pages/adduser.inc.php index 791d4d03d..7bb5c4838 100644 --- a/html/pages/adduser.inc.php +++ b/html/pages/adduser.inc.php @@ -27,7 +27,7 @@ else { // FIXME: missing email field here on the form if (adduser($_POST['new_username'], $_POST['new_password'], $_POST['new_level'], $_POST['new_email'], $_POST['new_realname'], $_POST['can_modify_passwd'])) { - echo 'User '.$_POST['username'].' added!'; + echo 'User '.$vars['username'].' added!'; } } else { diff --git a/html/pages/alert-log.inc.php b/html/pages/alert-log.inc.php index 752be46ce..4042b2e3d 100644 --- a/html/pages/alert-log.inc.php +++ b/html/pages/alert-log.inc.php @@ -51,7 +51,7 @@ foreach (get_all_devices() as $hostname) { $device_id = getidbyname($hostname); if (device_permitted($device_id)) { echo '"
    - +
    + - +
    diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 94a296822..9517dd96c 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -210,6 +210,16 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) { $routing_tabs[] = 'vrf'; } + require_once "../includes/component.php"; + $component = new component(); + $options['type'] = 'Cisco-OTV'; + $options['filter']['device_id'] = array('=',$device['device_id']); + $otv = $component->getComponents(null,$options); + $device_routing_count['cisco-otv'] = count($otv); + if ($device_routing_count['cisco-otv'] > 0) { + $routing_tabs[] = 'cisco-otv'; + } + if (is_array($routing_tabs)) { echo '
  • @@ -304,7 +314,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
  • '; } - if ($_SESSION['userlevel'] >= '7') { + if (is_admin()) { if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } @@ -388,19 +398,25 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) { } - echo '
  • https
  • -
  • ssh
  • -
  • telnet
  • '; - - if ($_SESSION['userlevel'] >= '7') { - echo '
  • + echo ''; echo ''; + }//end if if (device_permitted($device['device_id']) || $check_device == $vars['device']) { diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index e866e4504..62cd2a4c5 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -58,7 +58,7 @@ else { echo(generate_link($text,$link_array,array('section'=>$type))); -# echo(" " . $text .""); +# echo(" " . $text .""); if ($vars['section'] == $type) { echo(""); } diff --git a/html/pages/device/edit/snmp.inc.php b/html/pages/device/edit/snmp.inc.php index b77f3dcc4..b2749069a 100644 --- a/html/pages/device/edit/snmp.inc.php +++ b/html/pages/device/edit/snmp.inc.php @@ -194,11 +194,11 @@ echo "
    - '; + "; if ($config['distributed_poller'] === true) { echo ' diff --git a/html/pages/device/logs/eventlog.inc.php b/html/pages/device/logs/eventlog.inc.php index a5c60de86..f5f0444b6 100644 --- a/html/pages/device/logs/eventlog.inc.php +++ b/html/pages/device/logs/eventlog.inc.php @@ -2,7 +2,7 @@
    - +
    +
    '; foreach ($sensors as $sensor) { - if (empty($sensor['sensor_current'])) { + if (!isset($sensor['sensor_current'])) { $sensor['sensor_current'] = 'NaN'; } diff --git a/html/pages/device/routing.inc.php b/html/pages/device/routing.inc.php index e4be54617..c58fe17a8 100644 --- a/html/pages/device/routing.inc.php +++ b/html/pages/device/routing.inc.php @@ -20,6 +20,7 @@ $type_text['bgp'] = 'BGP'; $type_text['cef'] = 'CEF'; $type_text['ospf'] = 'OSPF'; $type_text['vrf'] = 'VRFs'; +$type_text['cisco-otv'] = 'OTV'; print_optionbar_start(); diff --git a/html/pages/device/routing/cisco-otv.inc.php b/html/pages/device/routing/cisco-otv.inc.php new file mode 100644 index 000000000..602f67abd --- /dev/null +++ b/html/pages/device/routing/cisco-otv.inc.php @@ -0,0 +1,94 @@ +getComponents($device['device_id'],$options); +$components = $components[$device['device_id']]; + +global $config; +?> +
    +
    +

    Overlay's & Adjacencies

    +
    +
    + $overlay) { + if ($overlay['otvtype'] == 'overlay') { + if ($overlay['status'] == 1) { + $overlay_status = "Normal"; + $gli = ""; + } + else { + $overlay_status = "".$overlay['error']." - Alert"; + $gli = "list-group-item-danger"; + } +?> + - + + +
    +
    + +
    +
    +

    AED Enabled VLAN's

    +
    +
    + +
    +
    + +
    +
    +

    MAC Addresses

    +
    +
    + +
    +
    diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index 9e5d0b1a6..917e85f1b 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -3,7 +3,7 @@ require 'includes/geshi/geshi.php'; // FIXME svn stuff still using optc etc, won't work, needs updating! -if ($_SESSION['userlevel'] >= '7') { +if (is_admin()) { if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } @@ -103,25 +103,68 @@ if ($_SESSION['userlevel'] >= '7') { } } else if ($config['oxidized']['enabled'] === true && isset($config['oxidized']['url'])) { + // fetch info about the node and then a list of versions for that node $node_info = json_decode(file_get_contents($config['oxidized']['url'].'/node/show/'.$device['hostname'].'?format=json'), true); - if ($config['oxidized']['features']['versioning'] === true && isset($_POST['config'])) { - list($oid,$date,$version) = explode('|',mres($_POST['config'])); - $text = file_get_contents($config['oxidized']['url'].'/node/version/view?node='.$device['hostname'].'&group=&oid='.$oid.'&date='.urlencode($date).'&num='.$version.'&format=text'); - if ($text == 'node not found') { - $text = file_get_contents($config['oxidized']['url'].'/node/version/view?node='.$device['hostname'].'&group='.(is_array($node_info) ? $node_info['group'] : $device['os']).'&oid='.$oid.'&date='.urlencode($date).'&num='.$version.'&format=text'); - } - } - else { - $text = file_get_contents($config['oxidized']['url'].'/node/fetch/'.$device['hostname']); - if ($text == 'node not found') { - $text = file_get_contents($config['oxidized']['url'].'/node/fetch/'.(is_array($node_info) ? $node_info['group'] : $device['os']).'/'.$device['hostname']); - } - } - if ($config['oxidized']['features']['versioning'] === true) { - $config_versions = json_decode(file_get_contents($config['oxidized']['url'].'/node/version?node_full='.$device['hostname'].'&format=json'), true); + if ($config['oxidized']['features']['versioning'] === true) { // fetch a list of versions + $config_versions = json_decode(file_get_contents($config['oxidized']['url'].'/node/version?node_full='.(isset($node_info['full_name']) ? $node_info['full_name'] : $device['hostname']).'&format=json'), true); } - if (is_array($node_info) || is_array($config_versions)) { + $config_total = 1; + if (is_array($config_versions)) { + $config_total = count($config_versions); + } + + if ($config_total > 1) { + // populate current_version + if (isset($_POST['config'])) { + list($oid,$date,$version) = explode('|',mres($_POST['config'])); + $current_config = array('oid'=>$oid, 'date'=>$date, 'version'=>$version); + } + else { // no version selected + $current_config = array('oid'=>$config_versions[0]['oid'], 'date'=>$current_config[0]['date'], 'version'=>$config_total); + } + + // populate previous_version + if (isset($_POST['diff'])) { // diff requested + list($oid,$date,$version) = explode('|',mres($_POST['prevconfig'])); + if (isset($oid) && $oid != $current_config['oid']) { + $previous_config = array('oid'=>$oid, 'date'=>$date, 'version'=>$version); + } + else if ($current_config['version'] != 1) { // assume previous, unless current is first config + foreach ($config_versions as $key => $version) { + if ($version['oid'] == $current_config['oid']) { + $prev_key = $key + 1; + $previous_config['oid'] = $config_versions[$prev_key]['oid']; + $previous_config['date'] = $config_versions[$prev_key]['date']; + $previous_config['version'] = $config_total - $prev_key; + break; + } + } + } + else { + print_error('No previous version, please select a different version.'); + } + } + + if (isset($previous_config)) { + $url = $config['oxidized']['url'].'/node/version/diffs?node='.$device['hostname'].'&group='; + if (!empty($node_info['group'])) { + $url .= $node_info['group']; + } + $url .= '&oid='.$current_config['oid'].'&date='.urlencode($current_config['date']).'&num='.$current_config['version'].'&oid2='.$previous_config['oid'].'&format=text'; + + $text = file_get_contents($url); // fetch diff + } else { + // fetch current_version + $text = file_get_contents($config['oxidized']['url'].'/node/version/view?node='.$device['hostname'].'&group='.(!empty($node_info['group']) ? $node_info['group'] : '').'&oid='.$current_config['oid'].'&date='.urlencode($current_config['date']).'&num='.$current_config['version'].'&format=text'); + } + } + else { // just fetch the only version + $text = file_get_contents($config['oxidized']['url'].'/node/fetch/'.(!empty($node_info['group']) ? $node_info['group'].'/' : '').$device['hostname']); + + } + + if (is_array($node_info) || $config_total > 1) { echo '
    '; @@ -142,7 +185,7 @@ if ($_SESSION['userlevel'] >= '7') { '; } - if (is_array($config_versions)) { + if ($config_total > 1) { echo '
    @@ -150,13 +193,27 @@ if ($_SESSION['userlevel'] >= '7') {
    + +
    @@ -183,12 +244,19 @@ if ($_SESSION['userlevel'] >= '7') { }//end if if (!empty($text)) { - $language = 'ios'; - $geshi = new GeSHi($text, $language); + if (isset($previous_config)) { + $language = 'diff'; + } else { + $language = 'ios'; + } + $geshi = new GeSHi($text, $language); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_overall_style('color: black;'); // $geshi->set_line_style('color: #999999'); + echo '
    '; + echo ''; echo $geshi->parse_code(); + echo '
    '; } }//end if diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php index 6d446d5c1..eb98e18ef 100644 --- a/html/pages/devices.inc.php +++ b/html/pages/devices.inc.php @@ -466,7 +466,7 @@ var grid = $("#devices").bootgrid({ return { id: "devices", format: '', - hostname: '', + hostname: '', os: '', version: '', hardware: '', diff --git a/html/pages/inventory.inc.php b/html/pages/inventory.inc.php index 14ae1a390..716c6812d 100644 --- a/html/pages/inventory.inc.php +++ b/html/pages/inventory.inc.php @@ -29,7 +29,7 @@ var grid = $("#inventory").bootgrid({ header: "
    "+ "
    "+ "
    "+ - "\" placeholder=\"Description\" class=\"form-control input-sm\" />"+ + "\" placeholder=\"Description\" class=\"form-control input-sm\" />"+ "
    "+ "
    "+ " Part No "+ @@ -48,7 +48,7 @@ foreach (dbFetchRows('SELECT `entPhysicalModelName` FROM `entPhysical` GROUP BY ""+ "
    "+ "
    "+ - "\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+ + "\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+ "
    "+ "
    "+ " Device "+ @@ -72,7 +72,7 @@ foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $data) { " "\" placeholder=\"Description\" class=\"form-control input-sm\"/>"+ @@ -85,11 +85,11 @@ foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $data) { { return { id: "inventory", - device: '', - string: '', - device_string: '', - part: '', - serial: '' + device: '', + string: '', + device_string: '', + part: '', + serial: '' }; }, url: "ajax_table.php" diff --git a/html/pages/routing.inc.php b/html/pages/routing.inc.php index 0a7fcb335..848c655e2 100644 --- a/html/pages/routing.inc.php +++ b/html/pages/routing.inc.php @@ -16,6 +16,7 @@ $type_text['bgp'] = 'BGP'; $type_text['cef'] = 'CEF'; $type_text['ospf'] = 'OSPF'; $type_text['vrf'] = 'VRFs'; +$type_text['cisco-otv'] = 'OTV'; print_optionbar_start(); @@ -53,6 +54,7 @@ switch ($vars['protocol']) { case 'vrf': case 'cef': case 'ospf': + case 'cisco-otv': include 'pages/routing/'.$vars['protocol'].'.inc.php'; break; diff --git a/html/pages/routing/cisco-otv.inc.php b/html/pages/routing/cisco-otv.inc.php new file mode 100644 index 000000000..00ca33bdd --- /dev/null +++ b/html/pages/routing/cisco-otv.inc.php @@ -0,0 +1,58 @@ +getComponents(null,$options); + +foreach ($COMPONENTS as $DEVICE_ID => $COMP) { + $LINK = generate_url(array('page' => 'device', 'device' => $DEVICE_ID, 'tab' => 'routing', 'proto' => 'cisco-otv')); +?> +
    + +
    + $OVERLAY) { + if ($OVERLAY['otvtype'] == 'overlay') { + if ($OVERLAY['status'] == 1) { + $OVERLAY_STATUS = "Normal"; + $GLI = ""; + } + else { + $OVERLAY_STATUS = "".$OVERLAY['error']." - Alert"; + $GLI = "list-group-item-danger"; + } + ?> + - + + +
    +
    += '5') { - if (!isset($_GET['optb'])) { - $_GET['optb'] = 'all'; + if (!isset($vars['optb'])) { + $vars['optb'] = 'all'; } - if (!isset($_GET['optc'])) { - $_GET['optc'] = 'basic'; + if (!isset($vars['optc'])) { + $vars['optc'] = 'basic'; } print_optionbar_start(); echo 'VRF » '; - if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') { + if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') { echo ""; } - echo 'All'; - if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') { + echo 'All'; + if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') { echo ''; } echo ' | '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') { echo ""; } - echo 'Basic'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') { + echo 'Basic'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') { echo ''; } echo ' | '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') { echo ""; } - echo 'Details'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') { + echo 'Details'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') { echo ''; } echo ' | Graphs: ( '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') { echo ""; } - echo 'Bits'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') { + echo 'Bits'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') { echo ''; } echo ' | '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') { echo ""; } - echo 'Packets'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') { + echo 'Packets'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') { echo ''; } echo ' | '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') { echo ""; } - echo 'NU Packets'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') { + echo 'NU Packets'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') { echo ''; } echo ' | '; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') { + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') { echo ""; } - echo 'Errors'; - if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') { + echo 'Errors'; + if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') { echo ''; } @@ -86,7 +86,7 @@ if ($_SESSION['userlevel'] >= '5') { print_optionbar_end(); - if ($_GET['optb'] == 'all') { + if ($vars['optb'] == 'all') { // Pre-Cache in arrays // That's heavier on RAM, but much faster on CPU (1:40) // Specifying the fields reduces a lot the RAM used (1:4) . @@ -123,7 +123,7 @@ if ($_SESSION['userlevel'] >= '5') { } echo "
    "; - echo "'; + echo "'; echo ''; // echo(""); echo '
    ".$vrf['vrf_name'].'
    '.$vrf['mplsVpnVrfDescription'].'
    ".$vrf['vrf_name'].'
    '.$vrf['mplsVpnVrfDescription'].'
    '.$vrf['mplsVpnVrfRouteDistinguisher'].'" . $vrf['mplsVpnVrfDescription'] . "'; @@ -158,7 +158,7 @@ if ($_SESSION['userlevel'] >= '5') { foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) { $port = array_merge($device, $port); - switch ($_GET['optc']) { + switch ($vars['optc']) { case 'bits': case 'upkts': case 'nupkts': @@ -168,7 +168,7 @@ if ($_SESSION['userlevel'] >= '5') { $port['from'] = $config['time']['day']; $port['to'] = $config['time']['now']; $port['bg'] = '#'.$bg; - $port['graph_type'] = 'port_'.$_GET['optc']; + $port['graph_type'] = 'port_'.$vars['optc']; echo "
    ".makeshortif($port['ifDescr']).'
    '; @@ -196,9 +196,9 @@ if ($_SESSION['userlevel'] >= '5') { } else { echo "
    "; - $vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($_GET['optb'])); + $vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($vars['optb'])); echo ""; - echo "'; + echo "'; echo ''; echo ''; echo '
    ".$vrf['vrf_name'].'".$vrf['vrf_name'].''.$vrf['mplsVpnVrfRouteDistinguisher'].''.$vrf['mplsVpnVrfDescription'].'
    '; diff --git a/html/pages/search.inc.php b/html/pages/search.inc.php index f6dcd9951..6e24c4ce2 100644 --- a/html/pages/search.inc.php +++ b/html/pages/search.inc.php @@ -28,7 +28,7 @@ foreach ($sections as $type => $texttype) { echo ""; } - // echo('' . $texttype .''); + // echo('' . $texttype .''); echo generate_link($texttype, array('page' => 'search', 'search' => $type)); if ($vars['search'] == $type) { diff --git a/html/pages/search/arp.inc.php b/html/pages/search/arp.inc.php index f6c6492d6..451d7f579 100644 --- a/html/pages/search/arp.inc.php +++ b/html/pages/search/arp.inc.php @@ -73,7 +73,7 @@ if ($_POST['searchby'] == 'ip') { "
    "+ " "\" class=\"form-control input-sm\" placeholder=\"Address\" />"+ @@ -86,9 +86,9 @@ echo '"'.$_POST['searchPhrase'].'"+'; { return { id: "arp-search", - device_id: '', - searchby: '', - searchPhrase: '' + device_id: '', + searchby: '', + searchPhrase: '' }; }, url: "ajax_table.php" diff --git a/html/pages/search/ipv4.inc.php b/html/pages/search/ipv4.inc.php index 3d4393ff8..9ad59b1ae 100644 --- a/html/pages/search/ipv4.inc.php +++ b/html/pages/search/ipv4.inc.php @@ -70,7 +70,7 @@ if ($_POST['interface'] == 'Vlan%') { ""+ "
     "+ "
    "+ - "\" class=\"form-control input-sm\" placeholder=\"IPv4 Address\"/>"+ + "\" class=\"form-control input-sm\" placeholder=\"IPv4 Address\"/>"+ "
     "+ ""+ "
    "+ @@ -81,9 +81,9 @@ if ($_POST['interface'] == 'Vlan%') { return { id: "address-search", search_type: "ipv4", - device_id: '', - interface: '', - address: '' + device_id: '', + interface: '', + address: '' }; }, url: "ajax_table.php" diff --git a/html/pages/search/ipv6.inc.php b/html/pages/search/ipv6.inc.php index 2ce8900b2..84ac7f7e4 100644 --- a/html/pages/search/ipv6.inc.php +++ b/html/pages/search/ipv6.inc.php @@ -71,7 +71,7 @@ if ($_POST['interface'] == 'Vlan%') { ""+ ""+ "
    "+ - "\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+ + "\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+ "
    "+ ""+ ""+ @@ -82,9 +82,9 @@ if ($_POST['interface'] == 'Vlan%') { return { id: "address-search", search_type: "ipv6", - device_id: '', - interface: '', - address: '' + device_id: '', + interface: '', + address: '' }; }, url: "ajax_table.php" diff --git a/html/pages/search/mac.inc.php b/html/pages/search/mac.inc.php index a73e132b4..2638e2e68 100644 --- a/html/pages/search/mac.inc.php +++ b/html/pages/search/mac.inc.php @@ -69,7 +69,7 @@ if ($_POST['interface'] == 'Vlan%') { "
    "+ " "\" class=\"form-control input-sm\" placeholder=\"Mac Address\"/>"+ @@ -83,9 +83,9 @@ echo '"'.$_POST['address'].'"+'; return { id: "address-search", search_type: "mac", - device_id: '', - interface: '', - address: '' + device_id: '', + interface: '', + address: '' }; }, url: "ajax_table.php" diff --git a/html/pages/search/packages.inc.php b/html/pages/search/packages.inc.php index 0848fc372..d7d428a9b 100644 --- a/html/pages/search/packages.inc.php +++ b/html/pages/search/packages.inc.php @@ -28,23 +28,23 @@ print_optionbar_start(28);
    - +
    - +
    - +
    0) { - $results = $_POST['results']; +if(isset($vars['results_amount']) && $vars['results_amount'] > 0) { + $results = $vars['results']; } else { $results = 50; @@ -81,15 +81,15 @@ if (is_admin() === FALSE && is_read() === FALSE) { $param[] = $_SESSION['user_id']; } -$query .= " WHERE packages.device_id = devices.device_id AND packages.name LIKE '%".mres($_POST['package'])."%' $sql_where GROUP BY packages.name"; +$query .= " WHERE packages.device_id = devices.device_id AND packages.name LIKE '%".mres($vars['package'])."%' $sql_where GROUP BY packages.name"; $where = ''; $ver = ""; $opt = ""; -if( !empty($_POST['arch']) ) { +if( !empty($vars['arch']) ) { $where .= ' AND packages.arch = ?'; - $param[] = mres($_POST['arch']); + $param[] = mres($vars['arch']); } if( is_numeric($_REQUEST['device_id']) ) { @@ -102,11 +102,11 @@ $count_query .= $query." ) sub"; $query .= $where." ORDER BY packages.name, packages.arch, packages.version"; $count = dbFetchCell($count_query,$param); -if( !isset($_POST['page_number']) && $_POST['page_number'] < 1 ) { +if( !isset($vars['page_number']) && $vars['page_number'] < 1 ) { $page_number = 1; } else { - $page_number = $_POST['page_number']; + $page_number = $vars['page_number']; } $start = ($page_number - 1) * $results; @@ -134,8 +134,8 @@ foreach( dbFetchRows($full_query, $param) as $entry ) { } } -if( !empty($_POST['version']) ) { - list($opt, $ver) = explode(" ",$_POST['version']); +if( !empty($vars['version']) ) { + list($opt, $ver) = explode(" ",$vars['version']); } foreach( $ordered as $name=>$entry ) { @@ -178,9 +178,9 @@ if( (int) ($count / $results) > 0 && $count != $results ) {
    - - - + + +