mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Fix Network scaling, DeviceDetials link, missing lang string, incorrectly mapped columns, default device values
This commit is contained in:
@@ -622,8 +622,8 @@ function getDevicesList() {
|
||||
|
||||
$defaultOrder = array ($row['dev_Name'],
|
||||
$row['dev_Owner'],
|
||||
$row['dev_DeviceType'],
|
||||
$row['dev_Icon'],
|
||||
handleNull($row['dev_DeviceType']),
|
||||
handleNull($row['dev_Icon'], "laptop"),
|
||||
$row['dev_Favorite'],
|
||||
$row['dev_Group'],
|
||||
formatDate ($row['dev_FirstConnection']),
|
||||
@@ -634,12 +634,12 @@ function getDevicesList() {
|
||||
$row['dev_MAC'], // MAC (hidden)
|
||||
formatIPlong ($row['dev_LastIP']), // IP orderable
|
||||
$row['rowid'], // Rowid (hidden)
|
||||
$row['dev_Network_Node_MAC_ADDR'] //
|
||||
handleNull($row['dev_Network_Node_MAC_ADDR']) //
|
||||
);
|
||||
|
||||
$newOrder = array();
|
||||
|
||||
|
||||
// reorder columns based on user settings
|
||||
for($index = 0; $index < count($columnOrderMapping); $index++)
|
||||
{
|
||||
array_push($newOrder, $defaultOrder[$columnOrderMapping[$index][2]]);
|
||||
@@ -757,10 +757,11 @@ function getIcons() {
|
||||
|
||||
// arrays of rows
|
||||
$tableData = array();
|
||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
$icon = handleNull($row['dev_Icon'], "laptop");
|
||||
// Push row data
|
||||
$tableData[] = array('id' => $row['dev_Icon'],
|
||||
'name' => '<i class="fa fa-'.$row['dev_Icon'].'"></i> - '.$row['dev_Icon'] );
|
||||
$tableData[] = array('id' => $icon,
|
||||
'name' => '<i class="fa fa-'.$icon.'"></i> - '.$icon );
|
||||
}
|
||||
|
||||
// Control no rows
|
||||
|
||||
@@ -80,6 +80,9 @@ function getParameter($skipCache, $defaultValue, $expireMinutes) {
|
||||
$value = $row[0];
|
||||
} else{
|
||||
$value = $defaultValue;
|
||||
|
||||
// Nothing found in the DB, Insert new value
|
||||
insertNew($parameter, $value);
|
||||
}
|
||||
|
||||
// update cache
|
||||
@@ -113,15 +116,7 @@ function setParameter($expireMinutes) {
|
||||
$changes = $db->changes();
|
||||
if ($changes == 0) {
|
||||
// Insert new value
|
||||
$sql = 'INSERT INTO Parameters (par_ID, par_Value)
|
||||
VALUES ("'. quotes($parameter) .'",
|
||||
"'. quotes($value) .'")';
|
||||
$result = $db->query($sql);
|
||||
|
||||
if (! $result == TRUE) {
|
||||
echo "Error creating parameter\n\n$sql \n\n". $db->lastErrorMsg();
|
||||
return;
|
||||
}
|
||||
insertNew($parameter, $value);
|
||||
}
|
||||
|
||||
// update cache
|
||||
@@ -130,4 +125,21 @@ function setParameter($expireMinutes) {
|
||||
echo 'OK';
|
||||
}
|
||||
|
||||
function insertNew($parameter, $value)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// Insert new value
|
||||
$sql = 'INSERT INTO Parameters (par_ID, par_Value)
|
||||
VALUES ("'. quotes($parameter) .'",
|
||||
"'. quotes($value) .'")';
|
||||
$result = $db->query($sql);
|
||||
|
||||
if (! $result == TRUE) {
|
||||
echo "Error creating parameter\n\n$sql \n\n". $db->lastErrorMsg();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -353,6 +353,18 @@ function logServerConsole ($text) {
|
||||
$x = array();
|
||||
$y = $x['__________'. $text .'__________'];
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function handleNull ($text, $default = "") {
|
||||
if($text == NULL || $text == 'NULL')
|
||||
{
|
||||
return $default;
|
||||
} else
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user