mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Fix coding style part 2
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
$sql = " FROM `devices` AS D";
|
||||
$sql = ' FROM `devices` AS D';
|
||||
|
||||
if (is_admin() === FALSE) {
|
||||
$sql .= ", devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.ignore = '0'";
|
||||
} else {
|
||||
$sql .= " WHERE 1";
|
||||
if (is_admin() === false) {
|
||||
$sql .= ", devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '".$_SESSION['user_id']."' AND D.ignore = '0'";
|
||||
}
|
||||
else {
|
||||
$sql .= ' WHERE 1';
|
||||
}
|
||||
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
@@ -19,13 +20,13 @@ if (!isset($sort) || empty($sort)) {
|
||||
$sql .= " AND D.status ='1' AND D.ignore='0' AND D.disabled='0' ORDER BY $sort";
|
||||
|
||||
$count_sql = "SELECT COUNT(`D`.`device_id`) $sql";
|
||||
$total = dbFetchCell($count_sql);
|
||||
$total = dbFetchCell($count_sql);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if (isset($current)) {
|
||||
$limit_low = ($current * $rowCount) - ($rowCount);
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
|
||||
@@ -36,12 +37,17 @@ if ($rowCount != -1) {
|
||||
$sql = "SELECT D.device_id,D.hostname AS `hostname`, D.last_polled AS `last_polled`, D.last_polled_timetaken AS `last_polled_timetaken` $sql";
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
$response[] = array('hostname' => "<a class='list-device' href='" .generate_device_url($device, array('tab' => 'graphs', 'group' => 'poller')). "'>" .$device['hostname']. "</a>",
|
||||
'last_polled' => $device['last_polled'],
|
||||
'last_polled_timetaken' => $device['last_polled_timetaken']);
|
||||
$response[] = array(
|
||||
'hostname' => "<a class='list-device' href='".generate_device_url($device, array('tab' => 'graphs', 'group' => 'poller'))."'>".$device['hostname'].'</a>',
|
||||
'last_polled' => $device['last_polled'],
|
||||
'last_polled_timetaken' => $device['last_polled_timetaken'],
|
||||
);
|
||||
}
|
||||
|
||||
$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total);
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user