diff --git a/back/pialert.py b/back/pialert.py index e8b0c560..0dcf27c3 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -2470,12 +2470,6 @@ def upgradeDB (): openDB() - # indicates, if Settings table is available - settingsMissing = sql.execute(""" - SELECT name FROM sqlite_master WHERE type='table' - AND name='Settings'; - """).fetchone() == None - # indicates, if Online_History table is available onlineHistoryAvailable = sql.execute(""" SELECT name FROM sqlite_master WHERE type='table' @@ -2509,24 +2503,6 @@ def upgradeDB (): ); """) - # Settings table - if settingsMissing: - file_print("[upgradeDB] Adding Settings table") - sql.execute(""" - CREATE TABLE "Settings" ( - "Index" INTEGER, - "Code_Name" TEXT, - "Display_Name" TEXT, - "Description" TEXT, - "Type" TEXT, - "Options" TEXT, - "RegEx" TEXT, - "Value" TEXT, - "Group" TEXT, - PRIMARY KEY("Index" AUTOINCREMENT) - ); - """) - # Alter Devices table # dev_Network_Node_MAC_ADDR column dev_Network_Node_MAC_ADDR_missing = sql.execute (""" @@ -2577,6 +2553,29 @@ def upgradeDB (): sql.executemany ("""INSERT INTO Parameters ("par_ID", "par_Value") VALUES (?, ?)""", params) + # indicates, if Settings table is available + settingsMissing = sql.execute(""" + SELECT name FROM sqlite_master WHERE type='table' + AND name='Settings'; + """).fetchone() == None + + # Re-creating Settings table + if settingsMissing: + file_print("[upgradeDB] Re-creating Settings table") + + sql.execute("DROP TABLE Settings;") + sql.execute(""" + CREATE TABLE "Settings" ( + "Code_Name" TEXT, + "Display_Name" TEXT, + "Description" TEXT, + "Type" TEXT, + "Options" TEXT, + "RegEx" TEXT, + "Value" TEXT, + "Group" TEXT + ); + """) # don't hog DB access closeDB () diff --git a/front/deviceDetails.php b/front/deviceDetails.php index 7e680c0c..36362843 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -34,11 +34,11 @@ if ($_SESSION["login"] != 1) @@ -53,7 +53,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -65,7 +65,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -77,7 +77,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -89,7 +89,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -107,14 +107,14 @@ if ($_SESSION["login"] != 1)
@@ -367,7 +367,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
@@ -375,7 +375,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
@@ -383,7 +383,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
@@ -404,7 +404,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
@@ -412,7 +412,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
@@ -420,7 +420,7 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
- +
    @@ -440,13 +440,13 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
+ id="btnDeleteEvents" onclick="askDeleteDeviceEvents()"> + id="btnDelete" onclick="askDeleteDevice()"> + id="btnRestore" onclick="getDeviceData(true)"> + id="btnSave" onclick="setDeviceData()" >
@@ -460,12 +460,12 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D - - - - - - + + + + + +
@@ -506,10 +506,10 @@ if ($_REQUEST['mac'] == 'Internet') {
@@ -520,10 +520,12 @@ if ($_REQUEST['mac'] == 'Internet') {
    -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
  • +
@@ -540,6 +542,7 @@ if ($_REQUEST['mac'] == 'Internet') { beforeSend: function() { $('#scanoutput').addClass("ajax_scripts_loading"); }, complete: function() { $('#scanoutput').removeClass("ajax_scripts_loading"); }, success: function(data, textStatus) { + console.log(data); $("#scanoutput").html(data); } }) @@ -577,7 +580,7 @@ if ($_REQUEST['mac'] == 'Internet') {
@@ -960,13 +963,13 @@ function initializeDatatables () { ''+ '', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -999,13 +1002,13 @@ function initializeDatatables () { ''+ '', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -1044,7 +1047,7 @@ function initializeCalendar () { slotLabelInterval : '04:00:00', slotLabelFormat : 'H:mm', timeFormat : 'H:mm', - locale : '', + locale : '', header: { left : 'prev,next today', center : 'title', @@ -1055,14 +1058,14 @@ function initializeCalendar () { agendaYear: { type : 'agenda', duration : { year: 1 }, - buttonText : '', + buttonText : '', columnHeaderFormat : '' }, agendaMonth: { type : 'agenda', duration : { month: 1 }, - buttonText : '', + buttonText : '', columnHeaderFormat : 'D' } }, @@ -1418,7 +1421,7 @@ function askSkipNotifications () { if ($('#chkArchived')[0].checked && $('#txtScanCycle').val().split(' ')[0] != "0") { // Ask skip notifications showModalDefault ('Device Archived', 'Do you want to skip all notifications for this device?', - '', '', 'skipNotifications'); + '', '', 'skipNotifications'); } } @@ -1442,8 +1445,8 @@ function askDeleteDeviceEvents () { } // Ask delete device Events - showModalWarning ('', '', - '', '', 'deleteDeviceEvents'); + showModalWarning ('', '', + '', '', 'deleteDeviceEvents'); } function deleteDeviceEvents () { @@ -1470,7 +1473,7 @@ function askDeleteDevice () { // Ask delete device showModalWarning ('Delete Device', 'Are you sure you want to delete this device?
(maybe you prefer to archive it)', - '', '', 'deleteDevice'); + '', '', 'deleteDevice'); } diff --git a/front/devices.php b/front/devices.php index 3faeb56b..08afe0d8 100755 --- a/front/devices.php +++ b/front/devices.php @@ -36,7 +36,7 @@

- +

@@ -49,7 +49,7 @@

--

-

+

@@ -61,7 +61,7 @@

--

-

+

@@ -73,7 +73,7 @@

--

-

+

@@ -85,7 +85,7 @@

--

-

+

@@ -97,7 +97,7 @@

--

-

+

@@ -109,7 +109,7 @@

--

-

+

@@ -124,7 +124,7 @@
-

+

@@ -160,19 +160,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + +
@@ -261,7 +261,7 @@ function initializeDatatable () { $('#tableDevices').DataTable({ 'paging' : true, 'lengthChange' : true, - 'lengthMenu' : [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, '']], + 'lengthMenu' : [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, '']], 'searching' : true, 'ordering' : true, @@ -333,13 +333,13 @@ function initializeDatatable () { 'language' : { processing: '
Loading...
', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -389,13 +389,13 @@ function getDevicesList (status) { // Define color & title for the status selected switch (deviceStatus) { - case 'all': tableTitle = ''; color = 'aqua'; break; - case 'connected': tableTitle = ''; color = 'green'; break; - case 'favorites': tableTitle = ''; color = 'yellow'; break; - case 'new': tableTitle = ''; color = 'yellow'; break; - case 'down': tableTitle = ''; color = 'red'; break; - case 'archived': tableTitle = ''; color = 'gray'; break; - default: tableTitle = ''; color = 'gray'; break; + case 'all': tableTitle = ''; color = 'aqua'; break; + case 'connected': tableTitle = ''; color = 'green'; break; + case 'favorites': tableTitle = ''; color = 'yellow'; break; + case 'new': tableTitle = ''; color = 'yellow'; break; + case 'down': tableTitle = ''; color = 'red'; break; + case 'archived': tableTitle = ''; color = 'gray'; break; + default: tableTitle = ''; color = 'gray'; break; } // Set title and color diff --git a/front/events.php b/front/events.php index 17c24e7b..0d1c3856 100755 --- a/front/events.php +++ b/front/events.php @@ -25,17 +25,17 @@ if ($_SESSION["login"] != 1)

- +

@@ -50,7 +50,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -62,7 +62,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -74,7 +74,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -86,7 +86,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -98,7 +98,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -110,7 +110,7 @@ if ($_SESSION["login"] != 1)

--

-

+

@@ -135,18 +135,18 @@ if ($_SESSION["login"] != 1) - - - - - - - - - - - - + + + + + + + + + + + +
@@ -261,13 +261,13 @@ function initializeDatatable () { 'language' : { processing: '
Loading...
', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -319,13 +319,13 @@ function getEvents (p_eventsType) { // Define color & title for the status selected switch (eventsType) { - case 'all': tableTitle = ''; color = 'aqua'; sesionCols = false; break; - case 'sessions': tableTitle = ''; color = 'green'; sesionCols = true; break; - case 'missing': tableTitle = ''; color = 'yellow'; sesionCols = true; break; - case 'voided': tableTitle = ''; color = 'yellow'; sesionCols = false; break; - case 'new': tableTitle = ''; color = 'yellow'; sesionCols = false; break; - case 'down': tableTitle = ''; color = 'red'; sesionCols = false; break; - default: tableTitle = ''; boxClass = ''; sesionCols = false; break; + case 'all': tableTitle = ''; color = 'aqua'; sesionCols = false; break; + case 'sessions': tableTitle = ''; color = 'green'; sesionCols = true; break; + case 'missing': tableTitle = ''; color = 'yellow'; sesionCols = true; break; + case 'voided': tableTitle = ''; color = 'yellow'; sesionCols = false; break; + case 'new': tableTitle = ''; color = 'yellow'; sesionCols = false; break; + case 'down': tableTitle = ''; color = 'red'; sesionCols = false; break; + default: tableTitle = ''; boxClass = ''; sesionCols = false; break; } // Set title and color diff --git a/front/help_faq.php b/front/help_faq.php index d1e50626..fd8e9c66 100755 --- a/front/help_faq.php +++ b/front/help_faq.php @@ -16,39 +16,39 @@ if ($_SESSION["login"] != 1)

- +

-

+

-
+

- +
-
+

- +

- +
@@ -56,12 +56,12 @@ if ($_SESSION["login"] != 1)

- +

- +
@@ -69,12 +69,12 @@ if ($_SESSION["login"] != 1)

- +

- +
@@ -82,48 +82,48 @@ if ($_SESSION["login"] != 1)

- +

- +
-

+

- +

- +
-

+

- "" / ""? + "" / ""?

- ""
- "" + ""
+ ""
@@ -131,12 +131,12 @@ if ($_SESSION["login"] != 1)

- "" + ""

- +
@@ -144,12 +144,12 @@ if ($_SESSION["login"] != 1)

- "" + ""

- +
@@ -157,29 +157,29 @@ if ($_SESSION["login"] != 1)

- +

- +
-

+

- +

- +
@@ -187,29 +187,29 @@ if ($_SESSION["login"] != 1)

- +

- +
-

+

- +

- +
diff --git a/front/index.php b/front/index.php index 25cb2150..4daaa75c 100755 --- a/front/index.php +++ b/front/index.php @@ -35,12 +35,44 @@ require '/home/pi/pialert/front/php/templates/language/'.$pia_lang_selected.'.ph // ################################### // ## GUI settings processing end // ################################### - foreach (glob("../db/setting_language*") as $filename) { - $pia_lang_selected = str_replace('setting_language_','',basename($filename)); - } - if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';} - require 'php/templates/language/'.$pia_lang_selected.'.php'; +// ################################### +// ## Languages +// ################################### +foreach (glob("../db/setting_language*") as $filename) { + $pia_lang_selected = str_replace('setting_language_','',basename($filename)); +} + +if (isset($pia_lang_selected) == FALSE or (strlen($pia_lang_selected) == 0)) {$pia_lang_selected = 'en_us';} + +require 'php/templates/language/en_us.php'; +require 'php/templates/language/de_de.php'; +require 'php/templates/language/es_es.php'; + +function lang($key) +{ +global $pia_lang_selected, $lang ; + +// try to get the selected language translation +$temp = $lang[$pia_lang_selected][$key]; + +if(isset($temp) == FALSE) +{ + // if not found, use English + $temp = $lang[$pia_lang_selected]["en_us"]; + + // echo $temp; + if(isset($temp) == FALSE) + { + // if not found, in English, use placeholder + $temp = "String not found"; + } +} + +// echo $temp; + +return $temp; +} // ################################### // ## PIALERT_WEB_PROTECTION FALSE // ################################### @@ -88,12 +120,12 @@ if ($_SESSION["login"] != 1) $login_info = 'Defaultpassword "123456" is still active'; $login_mode = 'danger'; $login_display_mode = 'display: block;'; - $login_headline = $pia_lang['Login_Toggle_Alert_headline']; + $login_headline = lang('Login_Toggle_Alert_headline'); $login_icon = 'fa-ban'; } else { $login_mode = 'info'; $login_display_mode = 'display: none;'; - $login_headline = $pia_lang['Login_Toggle_Info_headline']; + $login_headline = lang('Login_Toggle_Info_headline'); $login_icon = 'fa-info'; } @@ -141,10 +173,10 @@ if ($ENABLED_DARKMODE === True) {
- +
- +
@@ -180,7 +212,7 @@ if ($ENABLED_DARKMODE === True) {

-


./reset_password.sh

+


./reset_password.sh

diff --git a/front/maintenance.php b/front/maintenance.php index 10bc6b48..3528e74c 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -67,7 +67,7 @@ $pia_installed_skins = array('skin-black-light',

- +

@@ -89,9 +89,9 @@ if (!file_exists('../db/setting_stoparpscan')) { $execstring = 'ps -f -u root | grep "sudo arp-scan" 2>&1'; $pia_arpscans = ""; exec($execstring, $pia_arpscans); - $pia_arpscans_result = sizeof($pia_arpscans).' '.$pia_lang['Maintenance_arp_status_on']; + $pia_arpscans_result = sizeof($pia_arpscans).' '.lang('Maintenance_arp_status_on'); } else { - $pia_arpscans_result = 'arp-Scan '.$pia_lang['Maintenance_arp_status_off'] .''; + $pia_arpscans_result = 'arp-Scan '.lang('Maintenance_arp_status_off') .''; } // Count and Calc Backups ------------------------------------------------------- @@ -183,31 +183,31 @@ if (submit && isset($_POST['langselector_set'])) {
-
+
-
+
-
+
-
+
- +
-
+
@@ -221,16 +221,16 @@ if (submit && isset($_POST['langselector_set'])) {
@@ -301,39 +301,39 @@ if (submit && isset($_POST['langselector_set'])) {
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
@@ -341,33 +341,33 @@ if (submit && isset($_POST['langselector_set'])) {
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
@@ -377,7 +377,7 @@ if (submit && isset($_POST['langselector_set'])) {
-
+
-
+