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');
|
'<?php echo lang('Gen_Cancel');?>', '<?php echo lang('Gen_Delete');?>', 'deleteDeviceEvents');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
function deleteDeviceEvents () {
|
function deleteDeviceEvents () {
|
||||||
// Check MAC
|
// Check MAC
|
||||||
if (mac == '') {
|
if (mac == '') {
|
||||||
@@ -1645,23 +1646,28 @@ function loadNmap()
|
|||||||
var listData = JSON.parse(data);
|
var listData = JSON.parse(data);
|
||||||
var order = 1;
|
var order = 1;
|
||||||
|
|
||||||
|
|
||||||
tableRows = "";
|
tableRows = "";
|
||||||
|
|
||||||
// for each item
|
// for each item
|
||||||
listData.forEach(function (item, index) {
|
listData.forEach(function (item, index) {
|
||||||
tableRows += '<tr class="deviceSpecific"><td>'
|
tableRows += '<tr class="deviceSpecific">\
|
||||||
+item.Index+'</td><td>'
|
<td>'+item.Index+'</td>\
|
||||||
+item.Time+'</td><td><a href="http://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">'
|
<td>'+item.Time+'</td>\
|
||||||
+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>'
|
<td>\
|
||||||
+item.State+'</td><td>'
|
<a href="http://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">'+item.Port+'</a>\
|
||||||
+item.Service+'</td><td>'
|
<a href="https://'+item.IP+':'+item.Port.split('/')[0]+'" target="_blank">\
|
||||||
+'<div class="input-group">\
|
<span style="padding-left:5px"><i class="fa fa-lock "></i></a></span>\
|
||||||
<input class="form-control" id="port_'+item.Index+'" type="text" value="'+item.Extra+'">\
|
</td>\
|
||||||
<span class="input-group-addon"><i class="fa fa-save " onclick="saveNmapPort('+item.Index+')"></i></span>\
|
<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>\
|
</div>\
|
||||||
</td></tr>';
|
</td>\
|
||||||
});
|
</tr>';
|
||||||
|
});
|
||||||
|
|
||||||
$("#tableNmapBody").html($("#tableNmapBody").html()+tableRows);
|
$("#tableNmapBody").html($("#tableNmapBody").html()+tableRows);
|
||||||
$("#tableNmapPlc").hide();
|
$("#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){
|
function initTable(tableId, mac){
|
||||||
|
|||||||
@@ -10,28 +10,14 @@
|
|||||||
|
|
||||||
require '/home/pi/pialert/front/php/templates/timezone.php';
|
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/skinUI.php';
|
||||||
// require '/home/pi/pialert/front/php/templates/language/lang.php';
|
|
||||||
// require '/home/pi/pialert/front/php/server/db.php';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$FUNCTION = [];
|
$FUNCTION = [];
|
||||||
$SETTINGS = [];
|
$SETTINGS = [];
|
||||||
|
|
||||||
// displayMessage($_REQUEST);
|
|
||||||
|
|
||||||
|
|
||||||
// echo 'hereeeeeeeeeeeeeeeeeeeeee1';
|
|
||||||
|
|
||||||
// init request params
|
// init request params
|
||||||
if(array_key_exists('function', $_REQUEST) != FALSE)
|
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'];
|
$FUNCTION = $_REQUEST['function'];
|
||||||
displayMessage($FUNCTION);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists('settings', $_REQUEST) != FALSE)
|
if(array_key_exists('settings', $_REQUEST) != FALSE)
|
||||||
@@ -78,18 +64,22 @@ function createArray($input){
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function formatDate ($date1) {
|
function formatDate ($date1) {
|
||||||
return date_format (new DateTime ($date1) , 'Y-m-d H:i');
|
return date_format (new DateTime ($date1) , 'Y-m-d H:i');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function formatDateDiff ($date1, $date2) {
|
function formatDateDiff ($date1, $date2) {
|
||||||
return date_diff (new DateTime ($date1), new DateTime ($date2 ) )-> format ('%ad %H:%I');
|
return date_diff (new DateTime ($date1), new DateTime ($date2 ) )-> format ('%ad %H:%I');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function formatDateISO ($date1) {
|
function formatDateISO ($date1) {
|
||||||
return date_format (new DateTime ($date1),'c');
|
return date_format (new DateTime ($date1),'c');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function formatEventDate ($date1, $eventType) {
|
function formatEventDate ($date1, $eventType) {
|
||||||
if (!empty ($date1) ) {
|
if (!empty ($date1) ) {
|
||||||
$ret = formatDate ($date1);
|
$ret = formatDate ($date1);
|
||||||
@@ -102,6 +92,7 @@ function formatEventDate ($date1, $eventType) {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function formatIPlong ($IP) {
|
function formatIPlong ($IP) {
|
||||||
return sprintf('%u', ip2long($IP) );
|
return sprintf('%u', ip2long($IP) );
|
||||||
}
|
}
|
||||||
@@ -310,20 +301,26 @@ function getString ($codeName, $default) {
|
|||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function getDateFromPeriod () {
|
function getDateFromPeriod () {
|
||||||
$period = $_REQUEST['period'];
|
$period = $_REQUEST['period'];
|
||||||
return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"';
|
return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function quotes ($text) {
|
function quotes ($text) {
|
||||||
return str_replace ('"','""',$text);
|
return str_replace ('"','""',$text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function logServerConsole ($text) {
|
function logServerConsole ($text) {
|
||||||
$x = array();
|
$x = array();
|
||||||
$y = $x['__________'. $text .'__________'];
|
$y = $x['__________'. $text .'__________'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function getNetworkTypes(){
|
function getNetworkTypes(){
|
||||||
|
|
||||||
$array = array(
|
$array = array(
|
||||||
@@ -333,6 +330,7 @@ function getNetworkTypes(){
|
|||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function getDevicesColumns(){
|
function getDevicesColumns(){
|
||||||
|
|
||||||
$columns = ["dev_MAC",
|
$columns = ["dev_MAC",
|
||||||
@@ -375,7 +373,7 @@ function getCache($key) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// -------------------------------------------------------------------------------------------
|
||||||
function setCache($key, $value) {
|
function setCache($key, $value) {
|
||||||
setcookie($key, $value, time()+300, "/","", 0); // 5min cache
|
setcookie($key, $value, time()+300, "/","", 0); // 5min cache
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user