Merge branch 'master' into avtech

This commit is contained in:
Tony Murray
2016-02-23 09:51:34 -06:00
192 changed files with 19156 additions and 12963 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(htmlspecialchars_decode(dbFetchCell('select settings from users_widgets where user_widget_id = ?',array($widget_id))),true);
$widget_settings = json_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
@@ -29,7 +29,6 @@ if (!$_SESSION['authenticated']) {
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) {
header('Content-type: application/json');
include_once 'includes/forms/'.$_POST['type'].'.inc.php';
}
}
+15 -14
View File
@@ -16,6 +16,7 @@ if (!$_SESSION['authenticated']) {
$device = array();
$ports = array();
$bgp = array();
$limit = $config['webui']['global_search_result_limit'];
if (isset($_REQUEST['search'])) {
$search = mres($_REQUEST['search']);
@@ -49,10 +50,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'device') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT * FROM `devices` WHERE `hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%' ORDER BY hostname LIMIT 8");
$results = dbFetchRows("SELECT * FROM `devices` WHERE `hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%' ORDER BY hostname LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT * FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND (`hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%') ORDER BY hostname LIMIT 8", array($_SESSION['user_id']));
$results = dbFetchRows("SELECT * FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND (`hostname` LIKE '%".$search."%' OR `location` LIKE '%".$search."%') ORDER BY hostname LIMIT ".$limit, array($_SESSION['user_id']));
}
if (count($results)) {
@@ -102,10 +103,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'ports') {
// Search ports
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT `ports`.*,`devices`.* FROM `ports` LEFT JOIN `devices` ON `ports`.`device_id` = `devices`.`device_id` WHERE `ifAlias` LIKE '%".$search."%' OR `ifDescr` LIKE '%".$search."%' OR `ifName` LIKE '%".$search."%' ORDER BY ifDescr LIMIT 8");
$results = dbFetchRows("SELECT `ports`.*,`devices`.* FROM `ports` LEFT JOIN `devices` ON `ports`.`device_id` = `devices`.`device_id` WHERE `ifAlias` LIKE '%".$search."%' OR `ifDescr` LIKE '%".$search."%' OR `ifName` LIKE '%".$search."%' ORDER BY ifDescr LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT DISTINCT(`I`.`port_id`), `I`.*, `D`.`hostname` FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifAlias` LIKE '%".$search."%' OR `ifDescr` LIKE '%".$search."%' OR `ifName` LIKE '%".$search."%') ORDER BY ifDescr LIMIT 8", array($_SESSION['user_id'], $_SESSION['user_id']));
$results = dbFetchRows("SELECT DISTINCT(`I`.`port_id`), `I`.*, `D`.`hostname` FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifAlias` LIKE '%".$search."%' OR `ifDescr` LIKE '%".$search."%' OR `ifName` LIKE '%".$search."%') ORDER BY ifDescr LIMIT ".$limit, array($_SESSION['user_id'], $_SESSION['user_id']));
}
if (count($results)) {
@@ -154,10 +155,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'bgp') {
// Search bgp peers
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT `bgpPeers`.*,`devices`.* FROM `bgpPeers` LEFT JOIN `devices` ON `bgpPeers`.`device_id` = `devices`.`device_id` WHERE `astext` LIKE '%".$search."%' OR `bgpPeerIdentifier` LIKE '%".$search."%' OR `bgpPeerRemoteAs` LIKE '%".$search."%' ORDER BY `astext` LIMIT 8");
$results = dbFetchRows("SELECT `bgpPeers`.*,`devices`.* FROM `bgpPeers` LEFT JOIN `devices` ON `bgpPeers`.`device_id` = `devices`.`device_id` WHERE `astext` LIKE '%".$search."%' OR `bgpPeerIdentifier` LIKE '%".$search."%' OR `bgpPeerRemoteAs` LIKE '%".$search."%' ORDER BY `astext` LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT `bgpPeers`.*,`D`.* FROM `bgpPeers`, `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND `bgpPeers`.`device_id`=`D`.`device_id` AND (`astext` LIKE '%".$search."%' OR `bgpPeerIdentifier` LIKE '%".$search."%' OR `bgpPeerRemoteAs` LIKE '%".$search."%') ORDER BY `astext` LIMIT 8", array($_SESSION['user_id']));
$results = dbFetchRows("SELECT `bgpPeers`.*,`D`.* FROM `bgpPeers`, `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND `bgpPeers`.`device_id`=`D`.`device_id` AND (`astext` LIKE '%".$search."%' OR `bgpPeerIdentifier` LIKE '%".$search."%' OR `bgpPeerRemoteAs` LIKE '%".$search."%') ORDER BY `astext` LIMIT ".$limit, array($_SESSION['user_id']));
}
if (count($results)) {
@@ -209,10 +210,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'applications') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT * FROM `applications` INNER JOIN `devices` ON devices.device_id = applications.device_id WHERE `app_type` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%' ORDER BY hostname LIMIT 8");
$results = dbFetchRows("SELECT * FROM `applications` INNER JOIN `devices` ON devices.device_id = applications.device_id WHERE `app_type` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%' ORDER BY hostname LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT * FROM `applications` INNER JOIN `devices` AS `D` ON `D`.`device_id` = `applications`.`device_id` INNER JOIN `devices_perms` AS `P` ON `P`.`device_id` = `D`.`device_id` WHERE `P`.`user_id` = ? AND (`app_type` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%') ORDER BY hostname LIMIT 8", array($_SESSION['user_id']));
$results = dbFetchRows("SELECT * FROM `applications` INNER JOIN `devices` AS `D` ON `D`.`device_id` = `applications`.`device_id` INNER JOIN `devices_perms` AS `P` ON `P`.`device_id` = `D`.`device_id` WHERE `P`.`user_id` = ? AND (`app_type` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%') ORDER BY hostname LIMIT ".$limit, array($_SESSION['user_id']));
}
if (count($results)) {
@@ -255,10 +256,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'munin') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT * FROM `munin_plugins` INNER JOIN `devices` ON devices.device_id = munin_plugins.device_id WHERE `mplug_type` LIKE '%".$search."%' OR `mplug_title` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%' ORDER BY hostname LIMIT 8");
$results = dbFetchRows("SELECT * FROM `munin_plugins` INNER JOIN `devices` ON devices.device_id = munin_plugins.device_id WHERE `mplug_type` LIKE '%".$search."%' OR `mplug_title` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%' ORDER BY hostname LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT * FROM `munin_plugins` INNER JOIN `devices` AS `D` ON `D`.`device_id` = `munin_plugins`.`device_id` INNER JOIN `devices_perms` AS `P` ON `P`.`device_id` = `D`.`device_id` WHERE `P`.`user_id` = ? AND (`mplug_type` LIKE '%".$search."%' OR `mplug_title` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%') ORDER BY hostname LIMIT 8", array($_SESSION['user_id']));
$results = dbFetchRows("SELECT * FROM `munin_plugins` INNER JOIN `devices` AS `D` ON `D`.`device_id` = `munin_plugins`.`device_id` INNER JOIN `devices_perms` AS `P` ON `P`.`device_id` = `D`.`device_id` WHERE `P`.`user_id` = ? AND (`mplug_type` LIKE '%".$search."%' OR `mplug_title` LIKE '%".$search."%' OR `hostname` LIKE '%".$search."%') ORDER BY hostname LIMIT ".$limit, array($_SESSION['user_id']));
}
if (count($results)) {
@@ -301,10 +302,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'iftype') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT `ports`.ifType FROM `ports` WHERE `ifType` LIKE '%".$search."%' GROUP BY ifType ORDER BY ifType LIMIT 8");
$results = dbFetchRows("SELECT `ports`.ifType FROM `ports` WHERE `ifType` LIKE '%".$search."%' GROUP BY ifType ORDER BY ifType LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT `I`.ifType FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifType` LIKE '%".$search."%') GROUP BY ifType ORDER BY ifType LIMIT 8", array($_SESSION['user_id'], $_SESSION['user_id']));
$results = dbFetchRows("SELECT `I`.ifType FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifType` LIKE '%".$search."%') GROUP BY ifType ORDER BY ifType LIMIT ".$limit, array($_SESSION['user_id'], $_SESSION['user_id']));
}
if (count($results)) {
$found = 1;
@@ -323,10 +324,10 @@ if (isset($_REQUEST['search'])) {
else if ($_REQUEST['type'] == 'bill') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` WHERE `bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%' LIMIT 8");
$results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` WHERE `bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%' LIMIT ".$limit);
}
else {
$results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` INNER JOIN `bill_perms` ON `bills`.bill_id = `bill_perms`.bill_id WHERE `bill_perms`.user_id = ? AND (`bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%') LIMIT 8", array($_SESSION['user_id']));
$results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` INNER JOIN `bill_perms` ON `bills`.bill_id = `bill_perms`.bill_id WHERE `bill_perms`.user_id = ? AND (`bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%') LIMIT ".$limit, array($_SESSION['user_id']));
}
$json = json_encode($results);
die($json);
+3 -2
View File
@@ -40,8 +40,9 @@ require_once '../includes/dbFacile.php';
require_once '../includes/rewrites.php';
require_once 'includes/functions.inc.php';
require_once '../includes/rrdtool.inc.php';
require_once 'includes/authenticate.inc.php';
if($config['allow_unauth_graphs'] != true) {
require_once 'includes/authenticate.inc.php';
}
require 'includes/graphs/graph.inc.php';
$console_color = new Console_Color2();
+2 -2
View File
@@ -156,7 +156,7 @@ else {
</div>
</div>
<div class="table-responsive">
<table id="alerts" class="table table-hover table-condensed alerts">
<table id="alerts_'.$unique_id.'" class="table table-hover table-condensed alerts">
<thead>
<tr>
<th data-column-id="status" data-formatter="status" data-sortable="false">Status</th>
@@ -171,7 +171,7 @@ else {
</table>
</div>
<script>
var alerts_grid = $("#alerts").bootgrid({
var alerts_grid = $("#alerts_'.$unique_id.'").bootgrid({
ajax: true,
post: function ()
{
+2 -2
View File
@@ -68,14 +68,14 @@ if ($device['sysContact']) {
<td>Contact</td>';
if (get_dev_attrib($device, 'override_sysContact_bool')) {
echo '
<td>'.get_dev_attrib($device, 'override_sysContact_string').'</td>
<td>'.htmlspecialchars(get_dev_attrib($device, 'override_sysContact_string')).'</td>
</tr>
<tr>
<td>SNMP Contact</td>';
}
echo '
<td>'.$device['sysContact'].'</td>
<td>'.htmlspecialchars($device['sysContact']).'</td>
</tr>';
}
+1 -1
View File
@@ -205,7 +205,7 @@ foreach (dbFetchRows($full_query, $param) as $rule) {
echo '<strong><em>Inverted</em></strong> ';
}
echo '<i>'.$rule['rule'].'</i></td>';
echo '<i>'.htmlentities($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>'.$alert_entry['name'].'</td>';
echo '<td>'.htmlspecialchars($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'].' '.$entry['message'].'</td>
echo $entry['link'].' '.htmlspecialchars($entry['message']).'</td>
<td></td>
</tr>';
+1 -1
View File
@@ -31,5 +31,5 @@ else {
echo '<td>'.$entry['link'].'</td>';
echo '<td>'.$entry['message'].'</td>
echo '<td>'.htmlspecialchars($entry['message']).'</td>
</tr>';
+5 -2
View File
@@ -64,10 +64,13 @@ echo "
$since
</td>
<td>
<span class=box-desc>$message</span>
<span class='box-desc'>$message</span>
</td>
<td>
<span class=box-desc>$desc</span>
<span class='box-desc'>$desc</span>
</td>
<td>
<span class='box-desc'>".date('r',$service['service_changed'])."</span>
</td>
</tr>";
+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> '.$entry['msg'].'</td>';
<td><strong>'.$entry['program'].' : </strong> '.htmlspecialchars($entry['msg']).'</td>';
}
else {
$syslog_output .= '<td><i>'.$entry['date'].'</i>&nbsp;&nbsp;&nbsp;<strong>'.$entry['program'].'</strong>&nbsp;&nbsp;&nbsp;'.$entry['msg'].'</td>';
$syslog_output .= '<td><i>'.$entry['date'].'</i>&nbsp;&nbsp;&nbsp;<strong>'.$entry['program'].'</strong>&nbsp;&nbsp;&nbsp;'.htmlspecialchars($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,
$alert_entry['name'],
htmlspecialchars($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' => $alertlog['alert'],
'alert' => htmlspecialchars($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' => $eventlog['message'],
'message' => htmlspecialchars($eventlog['message']),
);
}
+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' => $syslog['msg'],
'msg' => htmlspecialchars($syslog['msg']),
);
}
-3
View File
@@ -43,6 +43,3 @@ 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,6 +214,14 @@ 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")) {
+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 '.$vars['username'].' added!</span>';
echo '<span class=info>User '.$_POST['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) == $vars['device_id']) {
if (getidbyname($hostname) == $_POST['device_id']) {
echo '" selected "+';
}
@@ -69,7 +69,7 @@ foreach (get_all_devices() as $hostname) {
{
return {
id: "alertlog",
device_id: '<?php echo $vars['device_id']; ?>'
device_id: '<?php echo htmlspecialchars($_POST['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 $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>");
$(".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>");
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($vars['token'])) {
$vars['token'] = bin2hex(openssl_random_pseudo_bytes(16));
if (empty($_POST['token'])) {
$_POST['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 $vars['token']; ?>" readonly>
<input type="text" class="form-control" id="token" name="token" value="<?php echo $_POST['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 $vars['description']; ?>">
<input type="text" class="form-control" id="description" name="description" value="<?php echo $_POST['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 $vars['hostname']; ?>" />
<input type="text" name="hostname" id="hostname" class="form-control input-sm" value="<?php echo $_POST['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($vars['id'])) {
if (is_numeric($_REQUEST['id'])) {
echo('
<div class="row">
<div class="col-sm-offset-2 col-sm-7">
');
if ($vars['confirm']) {
print_message(nl2br(delete_device(mres($vars['id'])))."\n");
if ($_REQUEST['confirm']) {
print_message(nl2br(delete_device(mres($_REQUEST['id'])))."\n");
}
else {
$device = device_by_id_cache($vars['id']);
$device = device_by_id_cache($_REQUEST['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 $vars['id'] ?>" />
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'] ?>" />
<input type="hidden" name="confirm" value="1" />
<!--<input type="hidden" name="remove_rrd" value="<?php echo $vars['remove_rrd']; ?>">-->
<!--<input type="hidden" name="remove_rrd" value="<?php echo $_POST['remove_rrd']; ?>">-->
<button type="submit" class="btn btn-danger">Confirm host deletion</button>
</div>
</form>
+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 . ($vars['optd'] ? "/" . $vars['optd'] : ''). "/'> " . $text ."</a>");
# echo("<a href='device/".$device['device_id']."/edit/" . $type . ($_GET['optd'] ? "/" . $_GET['optd'] : ''). "/'> " . $text ."</a>");
if ($vars['section'] == $type) {
echo("</span>");
}
+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 $vars['string']; ?>" required/>
<input type="text" name="string" placeholder="Search" class="form-control" id="string" value="<?php echo $_POST['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 $vars['string']; ?>" />
<input type="text" name="string" id="string" value="<?php echo $_POST['string']; ?>" />
</label>
<label>
<strong>Program</strong>
+8 -3
View File
@@ -87,9 +87,14 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
$menu_options['vlans'] = 'VLANs';
}
// Are there any CBQoS rrd's for this ifIndex?
$cbqos = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
if (!empty($cbqos)) {
// Are there any CBQoS components for this device?
require_once "../includes/component.php";
$component = new component();
$options = array(); // Re-init array in case it has been declared previously.
$options['filter']['type'] = array('=','Cisco-CBQOS');
$components = $component->getComponents($device['device_id'],$options);
$components = $components[$device['device_id']]; // We only care about our device id.
if (count($components) > 0) {
$menu_options['cbqos'] = 'CBQoS';
}
+72 -83
View File
@@ -41,90 +41,79 @@ function find_child($components,$parent,$level) {
}
}
$rrdarr = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
if (!empty($rrdarr)) {
require_once "../includes/component.php";
$component = new component();
$options['filter']['type'] = array('=','Cisco-CBQOS');
$components = $component->getComponents($device['device_id'],$options);
// We only care about our device id.
$components = $components[$device['device_id']];
if (!isset($vars['policy'])) {
// not set, find the first parent and use it.
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
// Found the first policy
$vars['policy'] = $id;
continue;
}
}
}
echo "\n\n";
// Display the ingress policy at the top of the page.
echo "<div class='col-md-6'><ul class='mktree' id='ingress'>";
echo '<div><strong><i class="fa fa-sign-in"></i>&nbsp;Ingress Policy:</strong></div>';
$found = false;
if (!isset($vars['policy'])) {
// not set, find the first parent and use it.
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
echo "<li class='liOpen'>";
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
find_child($components,$id,1);
echo "</li>";
$found = true;
}
}
if (!$found) {
// No Ingress policies
echo '<div><i>No Policies</i></div>';
}
echo '</ul></div>';
// Display the egress policy at the top of the page.
echo "<div class='col-md-6'><ul class='mktree' id='egress'>";
echo '<div><strong><i class="fa fa-sign-out"></i>&nbsp;Egress Policy:</strong></div>';
$found = false;
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
echo "<li class='liOpen'>";
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
find_child($components,$id,1);
echo "</li>";
$found = true;
}
}
if (!$found) {
// No Egress policies
echo '<div><i>No Policies</i></div>';
}
echo "</ul></div>\n\n";
// Let's make sure the policy we are trying to access actually exists.
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
// The policy exists.
echo "<div class='col-md-12'>&nbsp;</div>\n\n";
// Display each graph row.
echo "<div class='col-md-12'>";
echo "<div class='graphhead'>Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_traffic';
include 'includes/print-interface-graphs.inc.php';
echo "<div class='graphhead'>QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_bufferdrops';
include 'includes/print-interface-graphs.inc.php';
echo "<div class='graphhead'>Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_qosdrops';
include 'includes/print-interface-graphs.inc.php';
echo "</div>\n\n";
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
// Found the first policy
$vars['policy'] = $id;
continue;
}
}
}
echo "\n\n";
// Display the ingress policy at the top of the page.
echo "<div class='col-md-6'><ul class='mktree' id='ingress'>";
echo '<div><strong><i class="fa fa-sign-in"></i>&nbsp;Ingress Policy:</strong></div>';
$found = false;
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
echo "<li class='liOpen'>";
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
find_child($components,$id,1);
echo "</li>";
$found = true;
}
}
if (!$found) {
// No Ingress policies
echo '<div><i>No Policies</i></div>';
}
echo '</ul></div>';
// Display the egress policy at the top of the page.
echo "<div class='col-md-6'><ul class='mktree' id='egress'>";
echo '<div><strong><i class="fa fa-sign-out"></i>&nbsp;Egress Policy:</strong></div>';
$found = false;
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
echo "<li class='liOpen'>";
echo('<a href="' . generate_url($vars, array('policy' => $id)) . '">' . $array['label'] . '</a>');
find_child($components,$id,1);
echo "</li>";
$found = true;
}
}
if (!$found) {
// No Egress policies
echo '<div><i>No Policies</i></div>';
}
echo "</ul></div>\n\n";
// Let's make sure the policy we are trying to access actually exists.
foreach ($components as $id => $array) {
if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
// The policy exists.
echo "<div class='col-md-12'>&nbsp;</div>\n\n";
// Display each graph row.
echo "<div class='col-md-12'>";
echo "<div class='graphhead'>Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_traffic';
include 'includes/print-interface-graphs.inc.php';
echo "<div class='graphhead'>QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_bufferdrops';
include 'includes/print-interface-graphs.inc.php';
echo "<div class='graphhead'>Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."</div>";
$graph_array['policy'] = $vars['policy'];
$graph_type = 'port_cbqos_qosdrops';
include 'includes/print-interface-graphs.inc.php';
echo "</div>\n\n";
}
}
+1 -1
View File
@@ -466,7 +466,7 @@ var grid = $("#devices").bootgrid({
return {
id: "devices",
format: '<?php echo mres($vars['format']); ?>',
hostname: '<?php echo mres($vars['hostname']); ?>',
hostname: '<?php echo htmlspecialchars($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 $vars['string']; ?>\" placeholder=\"Description\" class=\"form-control input-sm\" />"+
"<input type=\"text\" name=\"string\" id=\"string\" value=\"<?php echo $_POST['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 $vars['serial']; ?>\" placeholder=\"Serial\" class=\"form-control input-sm\"/>"+
"<input type=\"text\" name=\"serial\" id=\"serial\" value=\"<?php echo $_POST['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 $vars['device_string'];
echo $_POST['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 $vars['device']; ?>',
string: '<?php echo $vars['string']; ?>',
device_string: '<?php echo $vars['device_string']; ?>',
part: '<?php echo $vars['part']; ?>',
serial: '<?php echo $vars['serial']; ?>'
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']); ?>'
};
},
url: "ajax_table.php"
+31 -31
View File
@@ -1,84 +1,84 @@
<?php
if ($_SESSION['userlevel'] >= '5') {
if (!isset($vars['optb'])) {
$vars['optb'] = 'all';
if (!isset($_GET['optb'])) {
$_GET['optb'] = 'all';
}
if (!isset($vars['optc'])) {
$vars['optc'] = 'basic';
if (!isset($_GET['optc'])) {
$_GET['optc'] = 'basic';
}
print_optionbar_start();
echo '<span style="font-weight: bold;">VRF</span> &#187; ';
if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') {
if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/all/'.$vars['optc'].'/">All</a>';
if ($vars['opta'] == 'vrf' && $vars['optb'] == 'all') {
echo '<a href="routing/vrf/all/'.$_GET['optc'].'/">All</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') {
echo '</span>';
}
echo ' | ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/basic/">Basic</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'basic') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/basic/">Basic</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') {
echo '</span>';
}
echo ' | ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/details/">Details</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'details') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/details/">Details</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') {
echo '</span>';
}
echo ' | Graphs: ( ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/bits/">Bits</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'bits') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/bits/">Bits</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') {
echo '</span>';
}
echo ' | ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/upkts/">Packets</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'upkts') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/upkts/">Packets</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') {
echo '</span>';
}
echo ' | ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/nupkts/">NU Packets</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'nupkts') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/nupkts/">NU Packets</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') {
echo '</span>';
}
echo ' | ';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') {
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="routing/vrf/'.$vars['optb'].'/errors/">Errors</a>';
if ($vars['opta'] == 'vrf' && $vars['optc'] == 'errors') {
echo '<a href="routing/vrf/'.$_GET['optb'].'/errors/">Errors</a>';
if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') {
echo '</span>';
}
@@ -86,7 +86,7 @@ if ($_SESSION['userlevel'] >= '5') {
print_optionbar_end();
if ($vars['optb'] == 'all') {
if ($_GET['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'].'/'.$vars['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'].'/'.$_GET['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 ($vars['optc']) {
switch ($_GET['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_'.$vars['optc'];
$port['graph_type'] = 'port_'.$_GET['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($vars['optb']));
$vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($_GET['optb']));
echo "<tr valign=top bgcolor='$bg_colour'>";
echo "<td width=200 class=list-large><a href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$vars['optc']."/'>".$vrf['vrf_name'].'</a></td>';
echo "<td width=200 class=list-large><a href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher'].'/'.$_GET['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 . ($vars['optb'] ? '/' . $vars['optb'] : ''). '/">' . $texttype .'</a>');
// echo('<a href="search/' . $type . ($_GET['optb'] ? '/' . $_GET['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 '"'.$vars['searchPhrase'].'"+';
echo '"'.$_POST['searchPhrase'].'"+';
?>
"\" class=\"form-control input-sm\" placeholder=\"Address\" />"+
@@ -86,9 +86,9 @@ echo '"'.$vars['searchPhrase'].'"+';
{
return {
id: "arp-search",
device_id: '<?php echo $vars['device_id']; ?>',
searchby: '<?php echo $vars['searchby']; ?>',
searchPhrase: '<?php echo $vars['searchPhrase']; ?>'
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
searchby: '<?php echo mres($_POST['searchby']); ?>',
searchPhrase: '<?php echo mres($_POST['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 $vars['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv4 Address\"/>"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $_POST['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 $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['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 $vars['address']; ?>\" class=\"form-control input-sm\" placeholder=\"IPv6 Address\"/>"+
"<input type=\"text\" name=\"address\" id=\"address\" size=40 value=\"<?php echo $_POST['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 $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['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 '"'.$vars['address'].'"+';
echo '"'.$_POST['address'].'"+';
?>
"\" class=\"form-control input-sm\" placeholder=\"Mac Address\"/>"+
@@ -83,9 +83,9 @@ echo '"'.$vars['address'].'"+';
return {
id: "address-search",
search_type: "mac",
device_id: '<?php echo $vars['device_id']; ?>',
interface: '<?php echo $vars['interface']; ?>',
address: '<?php echo $vars['address']; ?>'
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
interface: '<?php echo mres($_POST['interface']); ?>',
address: '<?php echo mres($_POST['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($vars['package']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="package" id="package" size=20 value="<?php echo($_POST['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($vars['version']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="version" id="version" size=20 value="<?php echo($_POST['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($vars['arch']); ?>" class="form-control input-sm" placeholder="Any" />
<input type="text" name="arch" id="arch" size=20 value="<?php echo($_POST['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($vars['results_amount']) && $vars['results_amount'] > 0) {
$results = $vars['results'];
if(isset($_POST['results_amount']) && $_POST['results_amount'] > 0) {
$results = $_POST['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($vars['package'])."%' $sql_where GROUP BY packages.name";
$query .= " WHERE packages.device_id = devices.device_id AND packages.name LIKE '%".mres($_POST['package'])."%' $sql_where GROUP BY packages.name";
$where = '';
$ver = "";
$opt = "";
if( !empty($vars['arch']) ) {
if( !empty($_POST['arch']) ) {
$where .= ' AND packages.arch = ?';
$param[] = mres($vars['arch']);
$param[] = mres($_POST['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($vars['page_number']) && $vars['page_number'] < 1 ) {
if( !isset($_POST['page_number']) && $_POST['page_number'] < 1 ) {
$page_number = 1;
}
else {
$page_number = $vars['page_number'];
$page_number = $_POST['page_number'];
}
$start = ($page_number - 1) * $results;
@@ -134,8 +134,8 @@ foreach( dbFetchRows($full_query, $param) as $entry ) {
}
}
if( !empty($vars['version']) ) {
list($opt, $ver) = explode(" ",$vars['version']);
if( !empty($_POST['version']) ) {
list($opt, $ver) = explode(" ",$_POST['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 $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']; ?>">
<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']; ?>">
</form>
<script type="text/javascript">
function updateResults(results) {
+1
View File
@@ -70,6 +70,7 @@ echo '<div class="table-responsive">
<th>Changed</th>
<th>Message</th>
<th>Description</th>
<th>Last Check</th>
</tr>';
if ($_SESSION['userlevel'] >= '5') {
$host_sql = 'SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY D.hostname ORDER BY D.hostname';
+24
View File
@@ -0,0 +1,24 @@
<?php
$no_refresh = true;
$config_groups = get_config_by_group('webui');
$search_conf = array(
array('name' => 'webui.global_search_result_limit',
'descr' => 'Set the max search result limit',
'type' => 'text',
),
);
echo '
<div class="panel-group" id="accordion">
<form class="form-horizontal" role="form" action="" method="post">
';
echo generate_dynamic_config_panel('Search settings',true,$config_groups,$search_conf);
echo '
</form>
</div>
';
+4 -4
View File
@@ -81,10 +81,10 @@ var grid = $("#syslog").bootgrid({
{
return {
id: "syslog",
device: '<?php echo $vars['device']; ?>',
program: '<?php echo $vars['program']; ?>',
to: '<?php echo $vars['to']; ?>',
from: '<?php echo $vars['from']; ?>',
device: '<?php echo htmlspecialchars($vars['device']); ?>',
program: '<?php echo htmlspecialchars($vars['program']); ?>',
to: '<?php echo htmlspecialchars($vars['to']); ?>',
from: '<?php echo htmlspecialchars($vars['from']); ?>',
};
},
url: "ajax_table.php"