fix: eventlog type variable collision (#5046)

This commit is contained in:
Tony Murray
2016-11-22 08:27:16 -06:00
committed by Neil Lathwood
parent 2aad2683b9
commit 6708c7cb81
3 changed files with 8 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ var eventlog_grid = $("#eventlog").bootgrid({
return {
id: "eventlog",
device: "' .mres($vars['device']) .'",
eventtype: "' .mres($vars['eventtype']) .'",
};
},
url: "ajax_table.php"

View File

@@ -7,9 +7,9 @@ if (is_numeric($_POST['device'])) {
$param[] = $_POST['device'];
}
if (!empty($_POST['type'])) {
if (!empty($_POST['eventtype'])) {
$where .= ' AND `E`.`type` = ?';
$param[] = $_POST['type'];
$param[] = $_POST['eventtype'];
}
if ($_POST['string']) {
@@ -58,7 +58,6 @@ foreach (dbFetchRows($sql, $param) as $eventlog) {
$type = '<b>'.generate_port_link($this_if, makeshortif(strtolower($this_if['label']))).'</b>';
} else {
$type = $eventlog['type'];
;
}
$response[] = array(

View File

@@ -41,16 +41,16 @@ print_optionbar_start();
<label>
<strong>Type: </strong>
</label>
<select name="type" id="type" class="form-control input-sm">
<select name="eventtype" id="eventtype" class="form-control input-sm">
<option value="">All types</option>
<?php
foreach (dbFetchRows("SELECT `type` FROM `eventlog` GROUP BY `type`") as $types) {
echo '<option value="'.$types['type'].'"';
if ($types['type'] === $_POST['type']) {
foreach (dbFetchColumn("SELECT `type` FROM `eventlog` GROUP BY `type`") as $type) {
echo "<option value='$type'";
if ($type === $_POST['eventtype']) {
echo ' selected';
}
echo '>'.$types['type'].'</option>';
echo ">$type</option>";
}
?>