From 57aefdf3321b7c89e0bb5d323f1c210f724a9376 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Fri, 25 Aug 2023 07:07:18 +1000 Subject: [PATCH] Pholus cleanup + conversion v0.4 --- front/deviceDetails.php | 73 +------------------------ front/php/server/devices.php | 50 +---------------- front/php/templates/language/de_de.json | 9 +-- front/php/templates/language/en_us.json | 11 +--- front/php/templates/language/es_es.json | 11 +--- front/settings.php | 2 +- 6 files changed, 8 insertions(+), 148 deletions(-) diff --git a/front/deviceDetails.php b/front/deviceDetails.php index f7baf7d8..bb1bd061 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -110,8 +110,7 @@
  • -
  • -
  • +
  • @@ -628,8 +627,7 @@ - - + @@ -684,28 +682,6 @@
    - -
    - - - - - - - - - - - - - - - - - - -
    -
    @@ -1897,12 +1873,7 @@ function initializeTabsNew () { // events on tab change $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var target = $(e.target).attr("href") // activated tab - - // load tab data only when needed (tab change) - if(target == "#panPholus") - { - loadPholus(); - } + if(target == "#panNmap") { loadNmap(); @@ -1960,40 +1931,6 @@ function loadNmap() }); } -// ----------------------------------------------------------------------------- - -function loadPholus() -{ - $(".deviceSpecific").remove(); // remove any previous data listed in teh table - - $.get('php/server/devices.php?action=getPholus&mac='+ mac, function(data) { - - 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 += ''+item.Index+''+item.Info+''+item.Time+''+item.IP_v4_or_v6+''+item.Record_Type+''+item.Value+''+ item.Extra +''; - }); - - $("#tablePholusBody").html($("#tablePholusBody").html()+tableRows); - $("#tablePholusPlc").hide(); - } - else - { - // console.log("else") - $("#tablePholusPlc").show(); - $(".deviceSpecific").remove(); - } - }); -} - //----------------------------------------------------------------------------------- function initTable(tableId, mac){ @@ -2064,10 +2001,6 @@ window.onload = function async() function reloadTab() { // tab loaded without switching - if(getCache("activeDevicesTab") == "tabPholus") - { - loadPholus(); - } if(getCache("activeDevicesTab") == "tabNmap") { diff --git a/front/php/server/devices.php b/front/php/server/devices.php index 39aaf5e2..62b40fd2 100755 --- a/front/php/server/devices.php +++ b/front/php/server/devices.php @@ -50,8 +50,7 @@ case 'getOwners': getOwners(); break; case 'getDeviceTypes': getDeviceTypes(); break; case 'getGroups': getGroups(); break; - case 'getLocations': getLocations(); break; - case 'getPholus': getPholus(); break; + case 'getLocations': getLocations(); break; case 'getNmap': getNmap(); break; case 'saveNmapPort': saveNmapPort(); break; case 'updateNetworkLeaf': updateNetworkLeaf(); break; @@ -1010,53 +1009,6 @@ function getLocations() { echo (json_encode ($tableData)); } -//------------------------------------------------------------------------------ -// Query the List of Pholus entries -//------------------------------------------------------------------------------ -function getPholus() { - global $db; - - // SQL - $mac = $_REQUEST['mac']; - - if ($mac == "Internet") // Not performing data lookup for router (improvement idea for later maybe) - { - echo "false"; - return; - } - - if (false === filter_var($mac , FILTER_VALIDATE_MAC)) { - throw new Exception('Invalid mac address'); - } - else{ - $sql = 'SELECT * from Pholus_Scan where MAC ="'.$mac.'" and Record_Type not in ("Question")'; - - // array - $tableData = array(); - - // execute query - $result = $db->query($sql); - while ($row = $result -> fetchArray (SQLITE3_ASSOC)){ - // Push row data - $tableData[] = array( 'Index' => $row['Index'], - 'Info' => $row['Info'], - 'Time' => $row['Time'], - 'MAC' => $row['MAC'], - 'IP_v4_or_v6' => $row['IP_v4_or_v6'], - 'Record_Type' => $row['Record_Type'], - 'Value' => $row['Value'], - 'Extra' => $row['Extra']); - } - - if(count($tableData) == 0) - { - echo "false"; - } else{ - // Return json - echo (json_encode ($tableData)); - } - } -} //------------------------------------------------------------------------------ // Query the List of Nmap entries diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 5869c53e..5a55c285 100755 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -130,14 +130,7 @@ "DevDetail_Tab_EventsTableDate" : "Datum", "DevDetail_Tab_EventsTableEvent" : "Ereignistype", "DevDetail_Tab_EventsTableIP" : "IP", - "DevDetail_Tab_EventsTableInfo" : "Zusätzliche Informationen", - "DevDetail_Tab_PholusTableIndex" : "Index", - "DevDetail_Tab_PholusTableInfo" : "Info", - "DevDetail_Tab_PholusTableTime" : "Zeit", - "DevDetail_Tab_PholusTableIP" : "IP", - "DevDetail_Tab_PholusTableEntry" : "Eintragstyp", - "DevDetail_Tab_PholusTableValue" : "Wert", - "DevDetail_Tab_PholusTableExtra" : "Extra", + "DevDetail_Tab_EventsTableInfo" : "Zusätzliche Informationen", "DevDetail_Internet_Speedtest" : "Online Speedtest", "DevDetail_Internet_Speedtest_Start" : "Speedtest starten", "DevDetail_MainInfo_Title" : "Haupt Infos", diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index 7164d886..86e932fd 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -147,16 +147,7 @@ "DevDetail_Tab_EventsTableDate" : "Date", "DevDetail_Tab_EventsTableEvent" : "Event type", "DevDetail_Tab_EventsTableIP" : "IP", - "DevDetail_Tab_EventsTableInfo" : "Additional info", - "DevDetail_Tab_Pholus" : " Pholus", - "DevDetail_Tab_PholusEmpty" : "Nothing sniffed out with Pholus for this device.", - "DevDetail_Tab_PholusTableIndex" : "Index", - "DevDetail_Tab_PholusTableInfo" : "Info", - "DevDetail_Tab_PholusTableTime" : "Time", - "DevDetail_Tab_PholusTableIP" : "IP", - "DevDetail_Tab_PholusTableEntry" : "Entry Type", - "DevDetail_Tab_PholusTableValue" : "Value", - "DevDetail_Tab_PholusTableExtra" : "Extra", + "DevDetail_Tab_EventsTableInfo" : "Additional info", "DevDetail_Tab_Plugins" : " Plugins", "DevDetail_Tab_NmapTableHeader" : "Scheduled scan results", "DevDetail_Tab_NmapTableText" : "Set up a schedule in Settings", diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index b8aac324..7fb1b82b 100755 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -147,16 +147,7 @@ "DevDetail_Tab_EventsTableDate" : "Fecha", "DevDetail_Tab_EventsTableEvent" : "Tipo de evento", "DevDetail_Tab_EventsTableIP" : "IP", - "DevDetail_Tab_EventsTableInfo" : "Información adicional", - "DevDetail_Tab_Pholus" : " Pholus", - "DevDetail_Tab_PholusEmpty" : "No se ha encontrado nada para este dispositivo con Pholus.", - "DevDetail_Tab_PholusTableIndex": "Índice", - "DevDetail_Tab_PholusTableInfo": "Información", - "DevDetail_Tab_PholusTableTime": "Hora", - "DevDetail_Tab_PholusTableIP": "IP", - "DevDetail_Tab_PholusTableEntry": "Tipo de entrada", - "DevDetail_Tab_PholusTableValue": "Valor", - "DevDetail_Tab_PholusTableExtra": "Extra", + "DevDetail_Tab_EventsTableInfo" : "Información adicional", "DevDetail_Tab_Plugins" : " Plugins", "DevDetail_Tab_NmapTableHeader" : "Resultados del escaneo programado", "DevDetail_Tab_NmapTableText" : "Establece la programación en los Ajustes", diff --git a/front/settings.php b/front/settings.php index e6e6668b..842d5bcd 100755 --- a/front/settings.php +++ b/front/settings.php @@ -112,7 +112,7 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) { const settingGroups = []; const settingKeyOfLists = []; // core groups are the ones not generated by plugins - const settingCoreGroups = ['General', 'NewDeviceDefaults', 'Email', 'Webhooks', 'Apprise', 'NTFY', 'PUSHSAFER', 'MQTT', 'DynDNS', 'Pholus', 'Nmap', 'API']; + const settingCoreGroups = ['General', 'NewDeviceDefaults', 'Email', 'Webhooks', 'Apprise', 'NTFY', 'PUSHSAFER', 'MQTT', 'DynDNS', 'Nmap', 'API']; // Loop through the settingsArray and collect unique settingGroups