mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
cleanup
This commit is contained in:
@@ -1513,6 +1513,7 @@ function askDeleteDeviceEvents () {
|
||||
'<?php echo lang('Gen_Cancel');?>', '<?php echo lang('Gen_Delete');?>', 'deleteDeviceEvents');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function deleteDeviceEvents () {
|
||||
// Check MAC
|
||||
if (mac == '') {
|
||||
@@ -1645,23 +1646,28 @@ function loadNmap()
|
||||
var listData = JSON.parse(data);
|
||||
var order = 1;
|
||||
|
||||
|
||||
tableRows = "";
|
||||
|
||||
// for each item
|
||||
listData.forEach(function (item, index) {
|
||||
tableRows += '<tr class="deviceSpecific"><td>'
|
||||
+item.Index+'</td><td>'
|
||||
+item.Time+'</td><td><a href="http://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">'
|
||||
+item.Port+'</a><a href="https://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank"><span style="padding-left:5px"><i class="fa fa-lock "></i></a></span></td><td>'
|
||||
+item.State+'</td><td>'
|
||||
+item.Service+'</td><td>'
|
||||
+'<div class="input-group">\
|
||||
<input class="form-control" id="port_'+item.Index+'" type="text" value="'+item.Extra+'">\
|
||||
<span class="input-group-addon"><i class="fa fa-save " onclick="saveNmapPort('+item.Index+')"></i></span>\
|
||||
tableRows += '<tr class="deviceSpecific">\
|
||||
<td>'+item.Index+'</td>\
|
||||
<td>'+item.Time+'</td>\
|
||||
<td>\
|
||||
<a href="http://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">'+item.Port+'</a>\
|
||||
<a href="https://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">\
|
||||
<span style="padding-left:5px"><i class="fa fa-lock "></i></a></span>\
|
||||
</td>\
|
||||
<td>'+item.State+'</td>\
|
||||
<td>'+item.Service+'</td>\
|
||||
<td>\
|
||||
<div class="input-group">\
|
||||
<input class="form-control" id="port_'+item.Index+'" type="text" value="'+item.Extra+'">\
|
||||
<span class="input-group-addon"><i class="fa fa-save " onclick="saveNmapPort('+item.Index+')"></i></span>\
|
||||
</div>\
|
||||
</td></tr>';
|
||||
});
|
||||
</td>\
|
||||
</tr>';
|
||||
});
|
||||
|
||||
$("#tableNmapBody").html($("#tableNmapBody").html()+tableRows);
|
||||
$("#tableNmapPlc").hide();
|
||||
@@ -1709,58 +1715,6 @@ function loadPholus()
|
||||
});
|
||||
}
|
||||
|
||||
// function loadPholus()
|
||||
// {
|
||||
// tableId = "tablePholus";
|
||||
|
||||
|
||||
// $.get('php/server/devices.php?action=getPholus&mac='+ mac, function(data) {
|
||||
|
||||
|
||||
// console.log("here URL mac:" + mac)
|
||||
// console.log("here table mac:" + $("#"+tableId).attr("data-mac"))
|
||||
// console.log("here")
|
||||
|
||||
// // check if already initialized
|
||||
// if($("#"+tableId).attr("data-mac") == mac)
|
||||
// {
|
||||
// console.log("return")
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// initTable(tableId, mac);
|
||||
|
||||
// data = sanitize(data);
|
||||
|
||||
// if(data != "false" && $.trim(data) != [])
|
||||
// {
|
||||
// var listData = JSON.parse(data);
|
||||
// var order = 1;
|
||||
|
||||
// tableRows = "";
|
||||
|
||||
// // for each item
|
||||
// listData.forEach(function (item, index) {
|
||||
// tableRows += '<tr class="deviceSpecific"><td>'+item.Index+'</td><td>'+item.Info+'</td><td>'+item.Time+'</td><td>'+item.IP_v4_or_v6+'</td><td>'+item.Record_Type+'</td><td>'+item.Value+'</td><td>'+item.Extra+'</td></tr>';
|
||||
// });
|
||||
|
||||
// $("#tablePholus tbody").first().html(tableRows);
|
||||
// // $("#tablePholusPlc").attr("style", "display:none");
|
||||
// // $("#tablePholusPlc").hide();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // console.log("else")
|
||||
// // $("#tablePholusPlc").show();
|
||||
// // $(".deviceSpecific").remove();
|
||||
// }
|
||||
|
||||
|
||||
// });
|
||||
// }
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
function initTable(tableId, mac){
|
||||
|
||||
@@ -10,28 +10,14 @@
|
||||
|
||||
require '/home/pi/pialert/front/php/templates/timezone.php';
|
||||
require '/home/pi/pialert/front/php/templates/skinUI.php';
|
||||
// require '/home/pi/pialert/front/php/templates/language/lang.php';
|
||||
// require '/home/pi/pialert/front/php/server/db.php';
|
||||
|
||||
|
||||
|
||||
$FUNCTION = [];
|
||||
$SETTINGS = [];
|
||||
|
||||
// displayMessage($_REQUEST);
|
||||
|
||||
|
||||
// echo 'hereeeeeeeeeeeeeeeeeeeeee1';
|
||||
|
||||
// init request params
|
||||
if(array_key_exists('function', $_REQUEST) != FALSE)
|
||||
{
|
||||
displayMessage(array_key_exists('function', $_REQUEST));
|
||||
displayMessage(array_key_exists('index', $_REQUEST));
|
||||
displayMessage(array_key_exists('value', $_REQUEST));
|
||||
$FUNCTION = $_REQUEST['function'];
|
||||
displayMessage($FUNCTION);
|
||||
|
||||
$FUNCTION = $_REQUEST['function'];
|
||||
}
|
||||
|
||||
if(array_key_exists('settings', $_REQUEST) != FALSE)
|
||||
@@ -78,18 +64,22 @@ function createArray($input){
|
||||
return $options;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function formatDate ($date1) {
|
||||
return date_format (new DateTime ($date1) , 'Y-m-d H:i');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function formatDateDiff ($date1, $date2) {
|
||||
return date_diff (new DateTime ($date1), new DateTime ($date2 ) )-> format ('%ad %H:%I');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function formatDateISO ($date1) {
|
||||
return date_format (new DateTime ($date1),'c');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function formatEventDate ($date1, $eventType) {
|
||||
if (!empty ($date1) ) {
|
||||
$ret = formatDate ($date1);
|
||||
@@ -102,6 +92,7 @@ function formatEventDate ($date1, $eventType) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function formatIPlong ($IP) {
|
||||
return sprintf('%u', ip2long($IP) );
|
||||
}
|
||||
@@ -310,20 +301,26 @@ function getString ($codeName, $default) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
function getDateFromPeriod () {
|
||||
$period = $_REQUEST['period'];
|
||||
return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"';
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function quotes ($text) {
|
||||
return str_replace ('"','""',$text);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function logServerConsole ($text) {
|
||||
$x = array();
|
||||
$y = $x['__________'. $text .'__________'];
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
function getNetworkTypes(){
|
||||
|
||||
$array = array(
|
||||
@@ -333,6 +330,7 @@ function getNetworkTypes(){
|
||||
return $array;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function getDevicesColumns(){
|
||||
|
||||
$columns = ["dev_MAC",
|
||||
@@ -375,7 +373,7 @@ function getCache($key) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
function setCache($key, $value) {
|
||||
setcookie($key, $value, time()+300, "/","", 0); // 5min cache
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user