Merge branch 'master' into avtech

This commit is contained in:
Tony Murray
2016-02-17 11:55:08 -06:00
101 changed files with 6547 additions and 1476 deletions
+1 -1
View File
@@ -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);
+1
View File
@@ -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'];
Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

@@ -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++;
}
+2 -2
View File
@@ -68,14 +68,14 @@ if ($device['sysContact']) {
<td>Contact</td>';
if (get_dev_attrib($device, 'override_sysContact_bool')) {
echo '
<td>'.htmlspecialchars(get_dev_attrib($device, 'override_sysContact_string')).'</td>
<td>'.get_dev_attrib($device, 'override_sysContact_string').'</td>
</tr>
<tr>
<td>SNMP Contact</td>';
}
echo '
<td>'.htmlspecialchars($device['sysContact']).'</td>
<td>'.$device['sysContact'].'</td>
</tr>';
}
+194
View File
@@ -0,0 +1,194 @@
<?php
/*************************************************************************************
* diff.php
* --------
* Author: Conny Brunnkvist (conny@fuchsia.se), W. Tasin (tasin@fhm.edu)
* Copyright: (c) 2004 Fuchsia Open Source Solutions (http://www.fuchsia.se/)
* Release Version: 1.0.8.12
* Date Started: 2004/12/29
*
* Diff-output language file for GeSHi.
*
* CHANGES
* -------
* 2008/05/23 (1.0.7.22)
* - Added description of extra language features (SF#1970248)
* 2006/02/27
* - changing language file to use matching of start (^) and end ($) (wt)
* 2004/12/29 (1.0.0)
* - First Release
*
* TODO (updated 2006/02/27)
* -------------------------
*
*
*************************************************************************************
*
* This file is part of GeSHi.
*
* GeSHi 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 2 of the License, or
* (at your option) any later version.
*
* GeSHi 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 GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
************************************************************************************/
$language_data = array (
'LANG_NAME' => '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))\\&lt;.*$',
GESHI_REPLACE => '\\0',
GESHI_MODIFIERS => 'm',
GESHI_BEFORE => '',
GESHI_AFTER => ''
),
//Inserted lines
2 => array(
GESHI_SEARCH => '(^|(?<=\A\s))\\&gt;.*$',
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(
)
);
@@ -0,0 +1,62 @@
<?php
/*
* LibreNMS module to display Cisco Class-Based QoS Details
*
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
*
* 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;
}
@@ -0,0 +1,62 @@
<?php
/*
* LibreNMS module to display Cisco Class-Based QoS Details
*
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
*
* 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;
}
+1 -1
View File
@@ -205,7 +205,7 @@ foreach (dbFetchRows($full_query, $param) as $rule) {
echo '<strong><em>Inverted</em></strong> ';
}
echo '<i>'.htmlentities($rule['rule']).'</i></td>';
echo '<i>'.$rule['rule'].'</i></td>';
echo '<td>'.$rule['severity'].'</td>';
echo "<td><span id='alert-rule-".$rule['id']."' class='glyphicon glyphicon-".$ico.' glyphicon-large text-'.$col."'></span> ";
if ($rule_extra['mute'] === true) {
+1 -1
View File
@@ -15,7 +15,7 @@ if (!isset($alert_entry['device'])) {
</td>';
}
echo '<td>'.htmlspecialchars($alert_entry['name']).'</td>';
echo '<td>'.$alert_entry['name'].'</td>';
if ($alert_state != '') {
if ($alert_state == '0') {
+1 -1
View File
@@ -25,6 +25,6 @@ if ($entry['type'] == 'interface') {
$entry['link'] = '<b>'.generate_port_link(getifbyid($entry['reference'])).'</b>';
}
echo $entry['link'].' '.htmlspecialchars($entry['message']).'</td>
echo $entry['link'].' '.$entry['message'].'</td>
<td></td>
</tr>';
+1 -1
View File
@@ -31,5 +31,5 @@ else {
echo '<td>'.$entry['link'].'</td>';
echo '<td>'.htmlspecialchars($entry['message']).'</td>
echo '<td>'.$entry['message'].'</td>
</tr>';
+17 -1
View File
@@ -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") {
?>
<li class="dropdown">
@@ -443,6 +449,16 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
$separator++;
}
// Cisco OTV Links
if ($_SESSION['userlevel'] >= '5' && $routing_count['cisco-otv']) {
if ($separator) {
echo(' <li role="presentation" class="divider"></li>');
$separator = 0;
}
echo('<li><a href="routing/protocol=cisco-otv/"><i class="fa fa-exchange fa-fw fa-lg"></i> Cisco OTV </a></li>');
$separator++;
}
// BGP Sessions
if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp']) {
if ($separator) {
+2 -2
View File
@@ -8,10 +8,10 @@ if (device_permitted($entry['device_id'])) {
if ($vars['page'] != 'device') {
$syslog_output .= '<td>'.$entry['date'].'</td>
<td><strong>'.generate_device_link($entry).'</strong></td>
<td><strong>'.$entry['program'].' : </strong> '.htmlspecialchars($entry['msg']).'</td>';
<td><strong>'.$entry['program'].' : </strong> '.$entry['msg'].'</td>';
}
else {
$syslog_output .= '<td><i>'.$entry['date'].'</i>&nbsp;&nbsp;&nbsp;<strong>'.$entry['program'].'</strong>&nbsp;&nbsp;&nbsp;'.htmlspecialchars($entry['msg']).'</td>';
$syslog_output .= '<td><i>'.$entry['date'].'</i>&nbsp;&nbsp;&nbsp;<strong>'.$entry['program'].'</strong>&nbsp;&nbsp;&nbsp;'.$entry['msg'].'</td>';
}
$syslog_output .= '</tr>';
+1 -1
View File
@@ -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
+1 -1
View File
@@ -77,7 +77,7 @@ foreach (dbFetchRows($sql, $param) as $alertlog) {
'time_logged' => $alertlog['humandate'],
'details' => '<a class="glyphicon glyphicon-plus incident-toggle" style="display:none" data-toggle="collapse" data-target="#incident'.($rulei).'" data-parent="#alerts"></a>',
'hostname' => '<div class="incident">'.generate_device_link($dev, shorthost($dev['hostname'])).'<div id="incident'.($rulei).'" class="collapse">'.$fault_detail.'</div></div>',
'alert' => htmlspecialchars($alertlog['alert']),
'alert' => $alertlog['alert'],
'status' => "<b><span class='glyphicon glyphicon-".$glyph_icon."' style='color:".$glyph_color."'></span> $text</b>",
);
}//end foreach
+1 -1
View File
@@ -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'],
);
}
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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'],
);
}
+3
View File
@@ -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);
-8
View File
@@ -214,14 +214,6 @@ else {
<div class="col-md-12">
<?php
// To help debug the new URLs :)
if (isset($devel) || isset($vars['devel'])) {
echo("<pre>");
print_r($_GET);
print_r($vars);
echo("</pre>");
}
if ($_SESSION['authenticated']) {
// Authenticated. Print a page.
if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file("pages/" . $vars['page'] . ".inc.php")) {
+21
View File
@@ -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($('<ul>'+$(this).html()+'</ul>'))
lines = 'off';
$('#linenumbers').val('Show line numbers');
});
}
else {
$($('.config').find('ul').get().reverse()).each(function(){
$(this).replaceWith($('<ol>'+$(this).html()+'</ol>'));
lines = 'on';
$('#linenumbers').val('Hide line numbers');
});
}
});
});
+1 -1
View File
@@ -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 '<span class=info>User '.$_POST['username'].' added!</span>';
echo '<span class=info>User '.$vars['username'].' added!</span>';
}
}
else {
+3 -3
View File
@@ -51,7 +51,7 @@ foreach (get_all_devices() as $hostname) {
$device_id = getidbyname($hostname);
if (device_permitted($device_id)) {
echo '"<option value=\"'.$device_id.'\""+';
if (getidbyname($hostname) == $_POST['device_id']) {
if (getidbyname($hostname) == $vars['device_id']) {
echo '" selected "+';
}
@@ -69,7 +69,7 @@ foreach (get_all_devices() as $hostname) {
{
return {
id: "alertlog",
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>'
device_id: '<?php echo $vars['device_id']; ?>'
};
},
url: "ajax_table.php"
@@ -81,7 +81,7 @@ foreach (get_all_devices() as $hostname) {
max = high - low;
search = $('.search-field').val();
$(".pdf-export").html("<a href='pdf.php?report=alert-log&device_id=<?php echo $_POST['device_id']; ?>&string="+search+"&results="+max+"&start="+low+"'><img src='images/16/pdf.png' width='16' height='16' alt='Export to pdf'> Export to pdf</a>");
$(".pdf-export").html("<a href='pdf.php?report=alert-log&device_id=<?php echo $vars['device_id']; ?>&string="+search+"&results="+max+"&start="+low+"'><img src='images/16/pdf.png' width='16' height='16' alt='Export to pdf'> Export to pdf</a>");
grid.find(".incident-toggle").each( function() {
$(this).parent().addClass('incident-toggle-td');
+4 -4
View File
@@ -13,8 +13,8 @@
*/
if ($_SESSION['userlevel'] >= '10') {
if (empty($_POST['token'])) {
$_POST['token'] = bin2hex(openssl_random_pseudo_bytes(16));
if (empty($vars['token'])) {
$vars['token'] = bin2hex(openssl_random_pseudo_bytes(16));
}
?>
@@ -65,7 +65,7 @@ foreach (dbFetchRows("SELECT user_id,username FROM `users` WHERE `level` >= '10'
<div class="form-group">
<label for="token" class="col-sm-2 control-label">Token: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="token" name="token" value="<?php echo $_POST['token']; ?>" readonly>
<input type="text" class="form-control" id="token" name="token" value="<?php echo $vars['token']; ?>" readonly>
</div>
<div class="col-sm-2">
</div>
@@ -73,7 +73,7 @@ foreach (dbFetchRows("SELECT user_id,username FROM `users` WHERE `level` >= '10'
<div class="form-group">
<label for="description" class="col-sm-2 control-label">Descr: </label>
<div class="col-sm-10">
<input type="text" class="form-control" id="description" name="description" value="<?php echo $_POST['description']; ?>">
<input type="text" class="form-control" id="description" name="description" value="<?php echo $vars['description']; ?>">
</div>
</div>
</div>
+1 -1
View File
@@ -9,7 +9,7 @@
Bills
</div>
<div class="form-group">
<input type="text" name="hostname" id="hostname" class="form-control input-sm" value="<?php echo $_POST['hostname']; ?>" />
<input type="text" name="hostname" id="hostname" class="form-control input-sm" value="<?php echo $vars['hostname']; ?>" />
</div>
<div class="form-group">
<select name='os' id='os' class="form-control input-sm">
+6 -6
View File
@@ -12,16 +12,16 @@ if ($_SESSION['userlevel'] == 11) {
}
else {
if (is_numeric($_REQUEST['id'])) {
if (is_numeric($vars['id'])) {
echo('
<div class="row">
<div class="col-sm-offset-2 col-sm-7">
');
if ($_REQUEST['confirm']) {
print_message(nl2br(delete_device(mres($_REQUEST['id'])))."\n");
if ($vars['confirm']) {
print_message(nl2br(delete_device(mres($vars['id'])))."\n");
}
else {
$device = device_by_id_cache($_REQUEST['id']);
$device = device_by_id_cache($vars['id']);
print_error("Are you sure you want to delete device " . $device['hostname'] . "?");
?>
<br />
@@ -30,9 +30,9 @@ else {
<br>
<form name="form1" method="post" action="" class="form-horizontal" role="form">
<div class="form-group">
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'] ?>" />
<input type="hidden" name="id" value="<?php echo $vars['id'] ?>" />
<input type="hidden" name="confirm" value="1" />
<!--<input type="hidden" name="remove_rrd" value="<?php echo $_POST['remove_rrd']; ?>">-->
<!--<input type="hidden" name="remove_rrd" value="<?php echo $vars['remove_rrd']; ?>">-->
<button type="submit" class="btn btn-danger">Confirm host deletion</button>
</div>
</form>
+25 -9
View File
@@ -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 '<li class="'.$select['routing'].'">
<a href="'.generate_device_url($device, array('tab' => 'routing')).'">
@@ -304,7 +314,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
</li>';
}
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 '<li style="float: right;"><a href="https://'.$device['hostname'].'"><img src="images/16/http.png" alt="https" title="Launch browser to https://'.$device['hostname'].'" border="0" width="16" height="16" target="_blank"></a></li>
<li style="float: right;"><a href="ssh://'.$device['hostname'].'"><img src="images/16/ssh.png" alt="ssh" title="SSH to '.$device['hostname'].'" border="0" width="16" height="16"></a></li>
<li style="float: right;"><a href="telnet://'.$device['hostname'].'"><img src="images/16/telnet.png" alt="telnet" title="Telnet to '.$device['hostname'].'" border="0" width="16" height="16"></a></li>';
if ($_SESSION['userlevel'] >= '7') {
echo '<li class="'.$select['edit'].'" style="float: right;">
echo '<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-cog"></i>
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="https://'.$device['hostname'].'"><img src="images/16/http.png" alt="https" title="Launch browser to https://'.$device['hostname'].'" border="0" width="16" height="16" target="_blank"> Launch</a></li>
<li><a href="ssh://'.$device['hostname'].'"><img src="images/16/ssh.png" alt="ssh" title="SSH to '.$device['hostname'].'" border="0" width="16" height="16"> SSH</a></li>
<li><a href="telnet://'.$device['hostname'].'"><img src="images/16/telnet.png" alt="telnet" title="Telnet to '.$device['hostname'].'" border="0" width="16" height="16"> Telnet</a></li>';
if (is_admin()) {
echo '<li>
<a href="'.generate_device_url($device, array('tab' => 'edit')).'">
<img src="images/16/wrench.png" align="absmiddle" border="0" />
Edit
</a>
</li>';
}
}
echo '</ul>
</div>';
echo '</ul>';
}//end if
if (device_permitted($device['device_id']) || $check_device == $vars['device']) {
+1 -1
View File
@@ -58,7 +58,7 @@ else {
echo(generate_link($text,$link_array,array('section'=>$type)));
# echo("<a href='device/".$device['device_id']."/edit/" . $type . ($_GET['optd'] ? "/" . $_GET['optd'] : ''). "/'> " . $text ."</a>");
# echo("<a href='device/".$device['device_id']."/edit/" . $type . ($vars['optd'] ? "/" . $vars['optd'] : ''). "/'> " . $text ."</a>");
if ($vars['section'] == $type) {
echo("</span>");
}
+2 -2
View File
@@ -194,11 +194,11 @@ echo " </select>
<div class='col-sm-4'>
<select id='cryptoalgo' name='cryptoalgo' class='form-control'>
<option value='AES'>AES</option>
<option value='DES' ".($device['cryptoalgo'] === 'DES' ? 'selected' : '').'>DES</option>
<option value='DES' ".($device['cryptoalgo'] === 'DES' ? 'selected' : '').">DES</option>
</select>
</div>
</div>
</div>';
</div>";
if ($config['distributed_poller'] === true) {
echo '
+1 -1
View File
@@ -2,7 +2,7 @@
<form method="post" action="">
<div class="row">
<div class="col-md-4">
<input type="text" name="string" placeholder="Search" class="form-control" id="string" value="<?php echo $_POST['string']; ?>" required/>
<input type="text" name="string" placeholder="Search" class="form-control" id="string" value="<?php echo $vars['string']; ?>" required/>
</div>
<div class="col-md-4">
<select name="type" class="form-control" id="type">
+1 -1
View File
@@ -3,7 +3,7 @@
<form method="post" action="">
<label><strong>Search</strong>
<input type="text" name="string" id="string" value="<?php echo $_POST['string']; ?>" />
<input type="text" name="string" id="string" value="<?php echo $vars['string']; ?>" />
</label>
<label>
<strong>Program</strong>
@@ -12,7 +12,7 @@ if (count($sensors)) {
echo ' </div>
<table class="table table-hover table-condensed table-striped">';
foreach ($sensors as $sensor) {
if (empty($sensor['sensor_current'])) {
if (!isset($sensor['sensor_current'])) {
$sensor['sensor_current'] = 'NaN';
}
+1
View File
@@ -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();
@@ -0,0 +1,94 @@
<?php
require_once "../includes/component.php";
$component = new component();
$options = array();
$options['filter']['ignore'] = array('=',0);
$options['type'] = 'Cisco-OTV';
$components = $component->getComponents($device['device_id'],$options);
$components = $components[$device['device_id']];
global $config;
?>
<div class="panel panel-default" id="overlays">
<div class="panel-heading">
<h3 class="panel-title">Overlay's & Adjacencies</h3>
</div>
<div class="panel list-group">
<?php
// Loop over each component, pulling out the Overlays.
foreach ($components as $oid => $overlay) {
if ($overlay['otvtype'] == 'overlay') {
if ($overlay['status'] == 1) {
$overlay_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
}
else {
$overlay_status = "<span class='pull-right'>".$overlay['error']." - <span class='red'>Alert</span></span>";
$gli = "list-group-item-danger";
}
?>
<a class="list-group-item <?=$gli?>" data-toggle="collapse" data-target="#<?=$overlay['index']?>" data-parent="#overlays"><?=$overlay['label']?> - <?=$overlay['transport']?> <?=$overlay_status?></a>
<div id="<?=$overlay['index']?>" class="sublinks collapse">
<?php
foreach ($components as $aid => $adjacency) {
if (($adjacency['otvtype'] == 'adjacency') && ($adjacency['index'] == $overlay['index'])) {
if ($adjacency['status'] == 1) {
$adj_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
}
else {
$adj_status = "<span class='pull-right'>".$adjacency['error']." - <span class='red'>Alert</span></span>";
$gli = "list-group-item-danger";
}
?>
<a class="list-group-item <?=$gli?> small"><span class="glyphicon glyphicon-chevron-right"></span> <?=$adjacency['label']?> - <?=$adjacency['endpoint']?> <?=$adj_status?></a>
<?php
}
}
?>
</div>
<?php
}
}
?>
</div>
</div>
<div class="panel panel-default" id="vlanperoverlay">
<div class="panel-heading">
<h3 class="panel-title">AED Enabled VLAN's</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_cisco-otv-vlan';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="macperendpoint">
<div class="panel-heading">
<h3 class="panel-title">MAC Addresses</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_cisco-otv-mac';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
+93 -25
View File
@@ -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 '<br />
<div class="row">
';
@@ -142,7 +185,7 @@ if ($_SESSION['userlevel'] >= '7') {
';
}
if (is_array($config_versions)) {
if ($config_total > 1) {
echo '
<div class="col-sm-8">
<form class="form-horizontal" action="" method="post">
@@ -150,13 +193,27 @@ if ($_SESSION['userlevel'] >= '7') {
<label for="config" class="col-sm-2 control-label">Config version</label>
<div class="col-sm-6">
<select id="config" name="config" class="form-control">
<option value="">Select version</option>
';
$config_total = count($config_versions);
$i = $config_total;
foreach ($config_versions as $version) {
echo '<option value="'.$version['oid'].'|'.$version['date'].'|'.$config_total.'">'.$config_total.' :: '.$version['date'].' - '.$version['message'].'</option>';
$config_total--;
echo '<option value="'.$version['oid'].'|'.$version['date'].'|'.$config_total.'" ';
if ($current_config['oid'] == $version['oid']) {
if (isset($previous_config)) {
echo 'selected>+';
}
else {
echo 'selected>*';
}
}
else if ($previous_config['oid'] == $version['oid']) {
echo '>&nbsp;-';
}
else {
echo '>&nbsp;&nbsp;';
}
echo $i.' :: '.$version['date'].'</option>';
$i--;
}
echo '
@@ -165,7 +222,11 @@ if ($_SESSION['userlevel'] >= '7') {
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-6">
<button type="submit" class="btn btn-primary btn-sm">Show version</button>
<input type="hidden" name="prevconfig" value="';
echo implode('|',$current_config);
echo '">
<button type="submit" class="btn btn-primary btn-sm" name="show">Show version</button>
<button type="submit" class="btn btn-primary btn-sm" name="diff">Show diff</button>
</div>
</div>
</form>
@@ -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 '<div class="config">';
echo '<input id="linenumbers" class="btn btn-primary" type="submit" value="Hide line numbers"/>';
echo $geshi->parse_code();
echo '</div>';
}
}//end if
+1 -1
View File
@@ -466,7 +466,7 @@ var grid = $("#devices").bootgrid({
return {
id: "devices",
format: '<?php echo mres($vars['format']); ?>',
hostname: '<?php echo htmlspecialchars($vars['hostname']); ?>',
hostname: '<?php echo mres($vars['hostname']); ?>',
os: '<?php echo mres($vars['os']); ?>',
version: '<?php echo mres($vars['version']); ?>',
hardware: '<?php echo mres($vars['hardware']); ?>',
+8 -8
View File
@@ -29,7 +29,7 @@ var grid = $("#inventory").bootgrid({
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\"><form method=\"post\" action=\"\" class=\"form-inline\" role=\"form\">"+
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"string\" id=\"string\" value=\"<?php echo $_POST['string']; ?>\" placeholder=\"Description\" class=\"form-control input-sm\" />"+
"<input type=\"text\" name=\"string\" id=\"string\" value=\"<?php echo $vars['string']; ?>\" placeholder=\"Description\" class=\"form-control input-sm\" />"+
"</div>"+
"<div class=\"form-group\">"+
"<strong>&nbsp;Part No&nbsp;</strong>"+
@@ -48,7 +48,7 @@ foreach (dbFetchRows('SELECT `entPhysicalModelName` FROM `entPhysical` GROUP BY
"</select>"+
"</div>"+
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"serial\" id=\"serial\" value=\"<?php echo $_POST['serial']; ?>\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+
"<input type=\"text\" name=\"serial\" id=\"serial\" value=\"<?php echo $vars['serial']; ?>\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+
"</div>"+
"<div class=\"form-group\">"+
"<strong>&nbsp;Device&nbsp;</strong>"+
@@ -72,7 +72,7 @@ foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $data) {
"<input type=\"text\" size=24 name=\"device_string\" id=\"device_string\" value=\""+
<?php
if ($_POST['device_string']) {
echo $_POST['device_string'];
echo $vars['device_string'];
};
?>
"\" 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: '<?php echo htmlspecialchars($_POST['device']); ?>',
string: '<?php echo mres($_POST['string']); ?>',
device_string: '<?php echo mres($_POST['device_string']); ?>',
part: '<?php echo mres($_POST['part']); ?>',
serial: '<?php echo mres($_POST['serial']); ?>'
device: '<?php echo $vars['device']; ?>',
string: '<?php echo $vars['string']; ?>',
device_string: '<?php echo $vars['device_string']; ?>',
part: '<?php echo $vars['part']; ?>',
serial: '<?php echo $vars['serial']; ?>'
};
},
url: "ajax_table.php"
+2
View File
@@ -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;
+58
View File
@@ -0,0 +1,58 @@
<?php
require_once "../includes/component.php";
$COMPONENT = new component();
$options = array();
$options['filter']['ignore'] = array('=',0);
$options['type'] = 'Cisco-OTV';
$COMPONENTS = $COMPONENT->getComponents(null,$options);
foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
$LINK = generate_url(array('page' => 'device', 'device' => $DEVICE_ID, 'tab' => 'routing', 'proto' => 'cisco-otv'));
?>
<div class="panel panel-default" id="overlays-<?=$DEVICE_ID?>">
<div class="panel-heading">
<h3 class="panel-title"><a href="<?=$LINK?>"><?=gethostbyid($DEVICE_ID)?> - Overlay's & Adjacencies</a></h3>
</div>
<div class="panel list-group">
<?php
// Loop over each component, pulling out the Overlays.
foreach ($COMP as $OID => $OVERLAY) {
if ($OVERLAY['otvtype'] == 'overlay') {
if ($OVERLAY['status'] == 1) {
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
}
else {
$OVERLAY_STATUS = "<span class='pull-right'>".$OVERLAY['error']." - <span class='red'>Alert</span></span>";
$GLI = "list-group-item-danger";
}
?>
<a class="list-group-item <?=$GLI?>" data-toggle="collapse" data-target="#<?=$OVERLAY['index']?>" data-parent="#overlays-<?=$DEVICE_ID?>"><?=$OVERLAY['label']?> - <?=$OVERLAY['transport']?> <?=$OVERLAY_STATUS?></a>
<div id="<?=$OVERLAY['index']?>" class="sublinks collapse">
<?php
foreach ($COMP as $AID => $ADJACENCY) {
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
if ($ADJACENCY['status'] == 1) {
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
}
else {
$ADJ_STATUS = "<span class='pull-right'>".$ADJACENCY['error']." - <span class='red'>Alert</span></span>";
$GLI = "list-group-item-danger";
}
?>
<a class="list-group-item <?=$GLI?> small"><span class="glyphicon glyphicon-chevron-right"></span> <?=$ADJACENCY['label']?> - <?=$ADJACENCY['endpoint']?> <?=$ADJ_STATUS?></a>
<?php
}
}
?>
</div>
<?php
}
}
?>
</div>
</div>
<?php
}
+31 -31
View File
@@ -1,84 +1,84 @@
<?php
if ($_SESSION['userlevel'] >= '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 '<span style="font-weight: bold;">VRF</span> &#187; ';
if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') {
if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/all/'.$_GET['optc'].'/">All</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') {
echo '<a href="routing/vrf/all/'.$vars['optc'].'/">All</a>';
if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') {
echo '</span>';
}
echo ' | ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/basic/">Basic</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') {
echo '<a href="routing/vrf/'.$vars['optb'].'/basic/">Basic</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') {
echo '</span>';
}
echo ' | ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/details/">Details</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') {
echo '<a href="routing/vrf/'.$vars['optb'].'/details/">Details</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') {
echo '</span>';
}
echo ' | Graphs: ( ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/bits/">Bits</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') {
echo '<a href="routing/vrf/'.$vars['optb'].'/bits/">Bits</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') {
echo '</span>';
}
echo ' | ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/upkts/">Packets</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') {
echo '<a href="routing/vrf/'.$vars['optb'].'/upkts/">Packets</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') {
echo '</span>';
}
echo ' | ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/nupkts/">NU Packets</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') {
echo '<a href="routing/vrf/'.$vars['optb'].'/nupkts/">NU Packets</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') {
echo '</span>';
}
echo ' | ';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') {
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$_GET['optb'].'/errors/">Errors</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') {
echo '<a href="routing/vrf/'.$vars['optb'].'/errors/">Errors</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') {
echo '</span>';
}
@@ -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 "<tr valign=top bgcolor='$bg_colour'>";
echo "<td width=240><a class=list-large href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$_GET['optc']."/'>".$vrf['vrf_name'].'</a><br /><span class=box-desc>'.$vrf['mplsVpnVrfDescription'].'</span></td>';
echo "<td width=240><a class=list-large href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$vars['optc']."/'>".$vrf['vrf_name'].'</a><br /><span class=box-desc>'.$vrf['mplsVpnVrfDescription'].'</span></td>';
echo '<td width=100 class=box-desc>'.$vrf['mplsVpnVrfRouteDistinguisher'].'</td>';
// echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
echo '<td><table border=0 cellspacing=0 cellpadding=5 width=100%>';
@@ -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 "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;
text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
<div style='font-weight: bold;'>".makeshortif($port['ifDescr']).'</div>';
@@ -196,9 +196,9 @@ if ($_SESSION['userlevel'] >= '5') {
}
else {
echo "<div style='background: $list_colour_a; padding: 10px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>";
$vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($_GET['optb']));
$vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($vars['optb']));
echo "<tr valign=top bgcolor='$bg_colour'>";
echo "<td width=200 class=list-large><a href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$_GET['optc']."/'>".$vrf['vrf_name'].'</a></td>';
echo "<td width=200 class=list-large><a href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$vars['optc']."/'>".$vrf['vrf_name'].'</a></td>';
echo '<td width=100 class=box-desc>'.$vrf['mplsVpnVrfRouteDistinguisher'].'</td>';
echo '<td width=200 class=box-desc>'.$vrf['mplsVpnVrfDescription'].'</td>';
echo '</table></div>';
+1 -1
View File
@@ -28,7 +28,7 @@ foreach ($sections as $type => $texttype) {
echo "<span class='pagemenu-selected'>";
}
// echo('<a href="search/' . $type . ($_GET['optb'] ? '/' . $_GET['optb'] : ''). '/">' . $texttype .'</a>');
// echo('<a href="search/' . $type . ($vars['optb'] ? '/' . $vars['optb'] : ''). '/">' . $texttype .'</a>');
echo generate_link($texttype, array('page' => 'search', 'search' => $type));
if ($vars['search'] == $type) {
+4 -4
View File
@@ -73,7 +73,7 @@ if ($_POST['searchby'] == 'ip') {
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"searchPhrase\" id=\"address\" value=\""+
<?php
echo '"'.$_POST['searchPhrase'].'"+';
echo '"'.$vars['searchPhrase'].'"+';
?>
"\" class=\"form-control input-sm\" placeholder=\"Address\" />"+
@@ -86,9 +86,9 @@ echo '"'.$_POST['searchPhrase'].'"+';
{
return {
id: "arp-search",
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
searchby: '<?php echo mres($_POST['searchby']); ?>',
searchPhrase: '<?php echo mres($_POST['searchPhrase']); ?>'
device_id: '<?php echo $vars['device_id']; ?>',
searchby: '<?php echo $vars['searchby']; ?>',
searchPhrase: '<?php echo $vars['searchPhrase']; ?>'
};
},
url: "ajax_table.php"
+4 -4
View File
@@ -70,7 +70,7 @@ if ($_POST['interface'] == 'Vlan%') {
"</select>"+
"</div>&nbsp;"+
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $_POST['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv4 Address\"/>"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $vars['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv4 Address\"/>"+
"</div>&nbsp;"+
"<button type=\"submit\" class=\"btn btn-default input-sm\">Search</button>"+
"</form></span></div>"+
@@ -81,9 +81,9 @@ if ($_POST['interface'] == 'Vlan%') {
return {
id: "address-search",
search_type: "ipv4",
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['address']); ?>'
device_id: '<?php echo $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
};
},
url: "ajax_table.php"
+4 -4
View File
@@ -71,7 +71,7 @@ if ($_POST['interface'] == 'Vlan%') {
"</select>"+
"</div>"+
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $_POST['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $vars['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+
"</div>"+
"<button type=\"submit\" class=\"btn btn-default input-sm\">Search</button>"+
"</form></span></div>"+
@@ -82,9 +82,9 @@ if ($_POST['interface'] == 'Vlan%') {
return {
id: "address-search",
search_type: "ipv6",
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['address']); ?>'
device_id: '<?php echo $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
};
},
url: "ajax_table.php"
+4 -4
View File
@@ -69,7 +69,7 @@ if ($_POST['interface'] == 'Vlan%') {
"<div class=\"form-group\">"+
"<input type=\"text\" name=\"address\" id=\"address\" value=\""+
<?php
echo '"'.$_POST['address'].'"+';
echo '"'.$vars['address'].'"+';
?>
"\" class=\"form-control input-sm\" placeholder=\"Mac Address\"/>"+
@@ -83,9 +83,9 @@ echo '"'.$_POST['address'].'"+';
return {
id: "address-search",
search_type: "mac",
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['address']); ?>'
device_id: '<?php echo $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
};
},
url: "ajax_table.php"
+15 -15
View File
@@ -28,23 +28,23 @@ print_optionbar_start(28);
<form method="post" action="" class="form-inline" role="form">
<div class="form-group">
<label for="package">Package</label>
<input type="text" name="package" id="package" size=20 value="<?php echo($_POST['package']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="package" id="package" size=20 value="<?php echo($vars['package']); ?>" class="form-control input-sm" placeholder="Any" />
</div>
<div class="form-group">
<label for="version">Version</label>
<input type="text" name="version" id="version" size=20 value="<?php echo($_POST['version']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="version" id="version" size=20 value="<?php echo($vars['version']); ?>" class="form-control input-sm" placeholder="Any" />
</div>
<div class="form-group">
<label for="version">Arch</label>
<input type="text" name="arch" id="arch" size=20 value="<?php echo($_POST['arch']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="arch" id="arch" size=20 value="<?php echo($vars['arch']); ?>" class="form-control input-sm" placeholder="Any" />
</div>
<button type="submit" class="btn btn-default input-sm">Search</button>
</form>
<?php
print_optionbar_end();
if(isset($_POST['results_amount']) && $_POST['results_amount'] > 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 ) {
</table>
<input type="hidden" name="page_number" id="page_number" value="<?php echo $page_number; ?>">
<input type="hidden" name="results_amount" id="results_amount" value="<?php echo $results; ?>">
<input type="hidden" name="package" id="results_packages" value="<?php echo $_POST['package']; ?>">
<input type="hidden" name="version" id="results_version" value="<?php echo $_POST['version']; ?>">
<input type="hidden" name="arch" id="results_arch" value="<?php echo $_POST['arch']; ?>">
<input type="hidden" name="package" id="results_packages" value="<?php echo $vars['package']; ?>">
<input type="hidden" name="version" id="results_version" value="<?php echo $vars['version']; ?>">
<input type="hidden" name="arch" id="results_arch" value="<?php echo $vars['arch']; ?>">
</form>
<script type="text/javascript">
function updateResults(results) {
+4
View File
@@ -244,6 +244,10 @@ $mail_conf = array(
'descr' => 'From name',
'type' => 'text',
),
array('name' => 'email_from',
'descr' => 'From email address',
'type' => 'text',
),
array('name' => 'email_sendmail_path',
'descr' => 'Sendmail path',
'type' => 'text',
+4 -4
View File
@@ -81,10 +81,10 @@ var grid = $("#syslog").bootgrid({
{
return {
id: "syslog",
device: '<?php echo htmlspecialchars($vars['device']); ?>',
program: '<?php echo htmlspecialchars($vars['program']); ?>',
to: '<?php echo htmlspecialchars($vars['to']); ?>',
from: '<?php echo htmlspecialchars($vars['from']); ?>',
device: '<?php echo $vars['device']; ?>',
program: '<?php echo $vars['program']; ?>',
to: '<?php echo $vars['to']; ?>',
from: '<?php echo $vars['from']; ?>',
};
},
url: "ajax_table.php"