Merge pull request #2382 from khobbits/patch-1

Quote column titles when sql building to avoid mysql keywords
This commit is contained in:
Daniel Preussker
2015-11-04 09:31:14 +00:00
2 changed files with 6 additions and 5 deletions
+1
View File
@@ -65,5 +65,6 @@ Contributors to LibreNMS:
- Sebastian Neuner <sebastian@sneuner.org> (9er)
- Robert Zollner <wolfit_ro@yahoo.com> (Lupul)
- Richard Hartmann <richih@debian.org> (RichiH)
- Robert Gornall <roblnm@khobbits.co.uk (KHobbits)
[1]: http://observium.org/ "Observium web site"
+5 -5
View File
@@ -163,23 +163,23 @@ function list_devices() {
}
if (stristr($order, ' desc') === false && stristr($order, ' asc') === false) {
$order .= ' ASC';
$order = '`'.$order.'` ASC';
}
if ($type == 'all' || empty($type)) {
$sql = '1';
}
elseif ($type == 'ignored') {
$sql = "ignore='1' AND disabled='0'";
$sql = "`ignore`='1' AND `disabled`='0'";
}
elseif ($type == 'up') {
$sql = "status='1' AND ignore='0' AND disabled='0'";
$sql = "`status`='1' AND `ignore`='0' AND `disabled`='0'";
}
elseif ($type == 'down') {
$sql = "status='0' AND ignore='0' AND disabled='0'";
$sql = "`status`='0' AND `ignore`='0' AND `disabled`='0'";
}
elseif ($type == 'disabled') {
$sql = "disabled='1'";
$sql = "`disabled`='1'";
}
elseif ($type == 'mac') {
$join = " LEFT JOIN `ports` ON `devices`.`device_id`=`ports`.`device_id` LEFT JOIN `ipv4_mac` ON `ports`.`port_id`=`ipv4_mac`.`port_id` ";