mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -39,16 +39,14 @@ if (is_admin() === false && is_read() === false) {
|
|||||||
|
|
||||||
$sql .= ' LEFT JOIN `devices` AS `D` ON `ports`.`device_id` = `D`.`device_id`';
|
$sql .= ' LEFT JOIN `devices` AS `D` ON `ports`.`device_id` = `D`.`device_id`';
|
||||||
|
|
||||||
if (!empty($_POST['hostname']) || !empty($_POST['location']) || $sort_column == 'device') {
|
if (!empty($_POST['hostname'])) {
|
||||||
if (!empty($_POST['hostname'])) {
|
|
||||||
$where .= ' AND `D`.`hostname` LIKE ?';
|
$where .= ' AND `D`.`hostname` LIKE ?';
|
||||||
$param[] = '%' . $_POST['hostname'] . '%';
|
$param[] = '%' . $_POST['hostname'] . '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST['location'])) {
|
if (!empty($_POST['location'])) {
|
||||||
$where .= " AND `D`.`location` = ?";
|
$where .= " AND `D`.`location` = ?";
|
||||||
$param[] = $_POST['location'];
|
$param[] = $_POST['location'];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " WHERE $where ";
|
$sql .= " WHERE $where ";
|
||||||
@@ -163,18 +161,11 @@ foreach (dbFetchRows($sql, $param) as $port) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug
|
|
||||||
//$vals = $param;
|
|
||||||
//$query = preg_replace_callback('/\?/', function ($match) use (&$vals) {
|
|
||||||
// return array_shift($vals); // wrap in quotes and sanitize
|
|
||||||
//}, $sql);
|
|
||||||
|
|
||||||
$output = array(
|
$output = array(
|
||||||
'current' => $current,
|
'current' => $current,
|
||||||
'rowCount' => $rowCount,
|
'rowCount' => $rowCount,
|
||||||
'rows' => $response,
|
'rows' => $response,
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
// 'sql' => $query,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
echo _json_encode($output);
|
echo _json_encode($output);
|
||||||
|
Reference in New Issue
Block a user