From b633c43078d98c805a7da81885bd5a4cb13e0669 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Date: Tue, 31 Jan 2023 09:27:42 +0100 Subject: [PATCH 1/2] Exclude vscode folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0f9ee596..d1c4fb64 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode .DS_Store config/pialert.conf db/* From 106438d61d04090aa44725dd4fd04af364c5fce1 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Date: Tue, 31 Jan 2023 12:10:07 +0100 Subject: [PATCH 2/2] lang in db --- back/pialert.py | 3 +- front/deviceDetails.php | 195 ++++++++++++----------- front/devices.php | 79 +++++----- front/events.php | 72 ++++----- front/help_faq.php | 70 ++++----- front/index.php | 16 +- front/maintenance.php | 208 +++++++++++-------------- front/network.php | 4 +- front/php/server/db.php | 7 +- front/php/server/devices.php | 5 +- front/php/server/events.php | 3 +- front/php/server/init.php | 5 + front/php/server/nmap_scan.php | 1 - front/php/server/parameters.php | 3 +- front/php/server/util.php | 4 +- front/php/templates/graph.php | 5 - front/php/templates/header.php | 26 ++-- front/php/templates/language/en_us.php | 8 +- front/php/templates/language/es_es.php | 2 +- front/php/templates/language/lang.php | 22 +-- front/php/templates/timezone.php | 6 +- front/presence.php | 42 ++--- front/settings.php | 22 +-- 23 files changed, 378 insertions(+), 430 deletions(-) create mode 100644 front/php/server/init.php diff --git a/back/pialert.py b/back/pialert.py index 7fcbf133..71dba460 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -269,7 +269,7 @@ def importConfig (): # Specify globals so they can be overwritten with the new config global lastTimeImported, mySettings # General - global ENABLE_ARPSCAN, SCAN_SUBNETS, PRINT_LOG, TIMEZONE, PIALERT_WEB_PROTECTION, PIALERT_WEB_PASSWORD, INCLUDED_SECTIONS, SCAN_CYCLE_MINUTES, DAYS_TO_KEEP_EVENTS, REPORT_DASHBOARD_URL, DIG_GET_IP_ARG + global ENABLE_ARPSCAN, SCAN_SUBNETS, PRINT_LOG, TIMEZONE, PIALERT_WEB_PROTECTION, PIALERT_WEB_PASSWORD, INCLUDED_SECTIONS, SCAN_CYCLE_MINUTES, DAYS_TO_KEEP_EVENTS, REPORT_DASHBOARD_URL, DIG_GET_IP_ARG, UI_LANG # Email global REPORT_MAIL, SMTP_SERVER, SMTP_PORT, REPORT_TO, REPORT_FROM, SMTP_SKIP_LOGIN, SMTP_USER, SMTP_PASS, SMTP_SKIP_TLS, SMTP_FORCE_SSL # Webhooks @@ -319,6 +319,7 @@ def importConfig (): DAYS_TO_KEEP_EVENTS = ccd('DAYS_TO_KEEP_EVENTS', 90 , c_d, 'Delete events days', 'integer', '', 'General') REPORT_DASHBOARD_URL = ccd('REPORT_DASHBOARD_URL', 'http://pi.alert/' , c_d, 'PiAlert URL', 'text', '', 'General') DIG_GET_IP_ARG = ccd('DIG_GET_IP_ARG', '-4 myip.opendns.com @resolver1.opendns.com' , c_d, 'DIG arguments', 'text', '', 'General') + UI_LANG = ccd('UI_LANG', 'English' , c_d, 'Language Interface', 'selecttext', "['English', 'German', 'Spanish']", 'General') # Email REPORT_MAIL = ccd('REPORT_MAIL', False , c_d, 'Enable email', 'boolean', '', 'Email', ['test']) diff --git a/front/deviceDetails.php b/front/deviceDetails.php index a2144bcd..cfa9d676 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -9,7 +9,6 @@ @@ -26,11 +25,11 @@ @@ -45,7 +44,7 @@

--

-

+

@@ -57,7 +56,7 @@

--

-

+

@@ -69,7 +68,7 @@

--

-

+

@@ -81,7 +80,7 @@

--

-

+

@@ -99,15 +98,15 @@
- +
@@ -354,12 +353,12 @@
-

+

- +
@@ -367,8 +366,8 @@
@@ -377,7 +376,7 @@
- +
@@ -385,7 +384,7 @@
- +
@@ -393,7 +392,7 @@
- +
@@ -414,7 +413,7 @@
- +
@@ -422,7 +421,7 @@
- +
@@ -430,7 +429,7 @@
- +
    @@ -450,13 +449,13 @@
+ id="btnDeleteEvents" onclick="askDeleteDeviceEvents()"> + id="btnDelete" onclick="askDeleteDevice()"> + id="btnRestore" onclick="getDeviceData(true)"> + id="btnSave" onclick="setDeviceData()" >
@@ -470,12 +469,12 @@ - - - - - - + + + + + +
@@ -516,10 +515,10 @@
@@ -530,11 +529,11 @@
    -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
@@ -559,9 +558,9 @@ } -

+

-
+
@@ -577,7 +576,7 @@ - +
@@ -614,7 +613,7 @@
@@ -648,7 +647,7 @@ - +
@@ -1065,13 +1064,13 @@ function initializeDatatables () { ''+ '', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -1104,13 +1103,13 @@ function initializeDatatables () { ''+ '', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -1149,7 +1148,7 @@ function initializeCalendar () { slotLabelInterval : '04:00:00', slotLabelFormat : 'H:mm', timeFormat : 'H:mm', - locale : '', + locale : '', header: { left : 'prev,next today', center : 'title', @@ -1160,14 +1159,14 @@ function initializeCalendar () { agendaYear: { type : 'agenda', duration : { year: 1 }, - buttonText : '', + buttonText : '', columnHeaderFormat : '' }, agendaMonth: { type : 'agenda', duration : { month: 1 }, - buttonText : '', + buttonText : '', columnHeaderFormat : 'D' } }, @@ -1453,7 +1452,7 @@ function recordSwitch(direction) { if(somethingChanged) { showModalDefaultStrParam ('Unsaved changes', 'Do you want to discard your changes?', - '', '', performSwitch, direction); + '', '', performSwitch, direction); } else { performSwitch(direction) @@ -1561,7 +1560,7 @@ function askSkipNotifications () { if ($('#chkArchived')[0].checked && $('#txtScanCycle').val() != "no") { // Ask skip notifications showModalDefault ('Device Archived', 'Do you want to skip all notifications for this device?', - '', '', 'skipNotifications'); + '', '', 'skipNotifications'); } } @@ -1583,8 +1582,8 @@ function askDeleteDeviceEvents () { } // Ask delete device Events - showModalWarning ('', '', - '', '', 'deleteDeviceEvents'); + showModalWarning ('', '', + '', '', 'deleteDeviceEvents'); } function deleteDeviceEvents () { @@ -1611,8 +1610,8 @@ function askOverwriteIconType () { } // Ask overwrite icon types - showModalWarning ('', '', - '', '', 'overwriteIconType'); + showModalWarning ('', '', + '', '', 'overwriteIconType'); } // ----------------------------------------------------------------------------- @@ -1642,7 +1641,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'); } @@ -1670,7 +1669,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'); } @@ -1892,13 +1891,13 @@ function initTable(tableId, mac){ ''+ '', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); diff --git a/front/devices.php b/front/devices.php index ed0d08c0..c37e7199 100755 --- a/front/devices.php +++ b/front/devices.php @@ -11,7 +11,6 @@ require 'php/templates/header.php'; require 'php/templates/graph.php'; - require 'php/server/util.php'; // check permissions @@ -27,7 +26,7 @@

- +

@@ -40,7 +39,7 @@

--

-

+

@@ -52,7 +51,7 @@

--

-

+

@@ -64,7 +63,7 @@

--

-

+

@@ -76,7 +75,7 @@

--

-

+

@@ -88,7 +87,7 @@

--

-

+

@@ -100,7 +99,7 @@

--

-

+

@@ -115,7 +114,7 @@
-

+

@@ -227,24 +226,24 @@ function main () { tableColumnOrder = numberArrayFromString(data); //initialize the table headers in the correct order - var headersDefaultOrder = [ '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '' + var headersDefaultOrder = [ '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '' ]; html = ''; @@ -328,7 +327,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, @@ -436,13 +435,13 @@ function initializeDatatable () { 'language' : { processing: '
Loading...
', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -524,13 +523,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 5ca34d41..44eba3a3 100755 --- a/front/events.php +++ b/front/events.php @@ -17,17 +17,17 @@

- +

@@ -42,7 +42,7 @@

--

-

+

@@ -54,7 +54,7 @@

--

-

+

@@ -66,7 +66,7 @@

--

-

+

@@ -78,7 +78,7 @@

--

-

+

@@ -90,7 +90,7 @@

--

-

+

@@ -102,7 +102,7 @@

--

-

+

@@ -127,18 +127,18 @@ - - - - - - - - - - - - + + + + + + + + + + + +
@@ -253,13 +253,13 @@ function initializeDatatable () { 'language' : { processing: '
Loading...
', emptyTable: 'No data', - "lengthMenu": "", - "search": ": ", + "lengthMenu": "", + "search": ": ", "paginate": { - "next": "", - "previous": "" + "next": "", + "previous": "" }, - "info": "", + "info": "", } }); @@ -311,13 +311,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 73c464d6..7b98cd9a 100755 --- a/front/help_faq.php +++ b/front/help_faq.php @@ -8,13 +8,13 @@

- +

-

+

@@ -22,16 +22,16 @@
-
+

- +
- +
@@ -42,12 +42,12 @@

- +

- +
@@ -55,12 +55,12 @@

- +

- +
@@ -68,12 +68,12 @@

- +

- +
@@ -81,48 +81,48 @@

- +

- +
-

+

- +

- +
-

+

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

- ""
- "" + ""
+ ""
@@ -130,12 +130,12 @@

- "" + ""

- +
@@ -143,12 +143,12 @@

- "" + ""

- +
@@ -156,29 +156,29 @@

- +

- +
-

+

- +

- +
@@ -186,29 +186,29 @@

- +

- +
-

+

- +

- +
diff --git a/front/index.php b/front/index.php index fe3eec4c..dc440963 100755 --- a/front/index.php +++ b/front/index.php @@ -1,7 +1,5 @@
- +
- +
@@ -136,7 +134,7 @@ if ($ENABLED_DARKMODE === True) {

-


./reset_password.sh

+


./reset_password.sh

diff --git a/front/maintenance.php b/front/maintenance.php index a5193bb0..d5d18af1 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -11,19 +11,6 @@ // leiweibau 2022 https://github.com/leiweibau GNU GPLv3 //------------------------------------------------------------------------------ -// Language selector config ---------------------------------------------------- -// -// For security reasons, new language files must be entered into this array. -// The files in the language directory are compared with this array and only -// then accepted. -// -$pia_installed_langs = array('en_us', - 'de_de', - 'es_es'); -// -// In addition to this, the language must also be added to the select tag in -// line 235. Later, the whole thing may become dynamic. - // Skin selector config ---------------------------------------------------- // // For security reasons, new language files must be entered into this array. @@ -57,7 +44,7 @@ $pia_installed_skins = array('skin-black-light',

- +

@@ -145,31 +132,31 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
-
+
">' .lang('Maintenance_new_version').''.'' .lang('Maintenance_current_version').'';?>
-
+
-
+
-
+
-
+
@@ -184,44 +171,27 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
@@ -390,7 +360,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -407,7 +377,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -425,7 +395,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -443,7 +413,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -460,7 +430,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -477,7 +447,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -528,7 +498,7 @@ initializeTabs(); // delete devices with emty macs function askDeleteDevicesWithEmptyMACs () { // Ask - showModalWarning('', '', + showModalWarning('', '', 'Cancel', 'Delete', 'deleteDevicesWithEmptyMACs'); } function deleteDevicesWithEmptyMACs() @@ -542,8 +512,8 @@ function deleteDevicesWithEmptyMACs() // delete all devices function askDeleteAllDevices () { // Ask - showModalWarning('', '', - '', '', 'deleteAllDevices'); + showModalWarning('', '', + '', '', 'deleteAllDevices'); } function deleteAllDevices() { @@ -556,8 +526,8 @@ function deleteAllDevices() // delete all (unknown) devices function askDeleteUnknown () { // Ask - showModalWarning('', '', - '', '', 'deleteUnknownDevices'); + showModalWarning('', '', + '', '', 'deleteUnknownDevices'); } function deleteUnknownDevices() { @@ -570,8 +540,8 @@ function deleteUnknownDevices() // delete all Events function askDeleteEvents () { // Ask - showModalWarning('', '', - '', '', 'deleteEvents'); + showModalWarning('', '', + '', '', 'deleteEvents'); } function deleteEvents() { @@ -584,8 +554,8 @@ function deleteEvents() // delete all Events older than 30 days function askDeleteEvents30 () { // Ask - showModalWarning('', '', - '', '', 'deleteEvents30'); + showModalWarning('', '', + '', '', 'deleteEvents30'); } function deleteEvents30() { @@ -598,8 +568,8 @@ function deleteEvents30() // delete History function askDeleteActHistory () { // Ask - showModalWarning('', '', - '', '', 'deleteActHistory'); + showModalWarning('', '', + '', '', 'deleteActHistory'); } function deleteActHistory() { @@ -612,8 +582,8 @@ function deleteActHistory() // Backup DB to Archive function askPiaBackupDBtoArchive () { // Ask - showModalWarning('', '', - '', '', 'PiaBackupDBtoArchive'); + showModalWarning('', '', + '', '', 'PiaBackupDBtoArchive'); } function PiaBackupDBtoArchive() { @@ -626,8 +596,8 @@ function PiaBackupDBtoArchive() // Restore DB from Archive function askPiaRestoreDBfromArchive () { // Ask - showModalWarning('', '', - '', '', 'PiaRestoreDBfromArchive'); + showModalWarning('', '', + '', '', 'PiaRestoreDBfromArchive'); } function PiaRestoreDBfromArchive() { @@ -640,8 +610,8 @@ function PiaRestoreDBfromArchive() // Purge Backups function askPiaPurgeDBBackups() { // Ask - showModalWarning('', '', - '', '', 'PiaPurgeDBBackups'); + showModalWarning('', '', + '', '', 'PiaPurgeDBBackups'); } function PiaPurgeDBBackups() { @@ -654,8 +624,8 @@ function PiaPurgeDBBackups() // Export CSV function askExportCSV() { // Ask - showModalWarning('', '', - '', '', 'ExportCSV'); + showModalWarning('', '', + '', '', 'ExportCSV'); } function ExportCSV() { @@ -666,8 +636,8 @@ function ExportCSV() // Import CSV function askImportCSV() { // Ask - showModalWarning('', '', - '', '', 'ImportCSV'); + showModalWarning('', '', + '', '', 'ImportCSV'); } function ImportCSV() { @@ -682,8 +652,8 @@ function ImportCSV() // Switch Darkmode function askToggleDarkmode() { // Ask - showModalWarning('', '', - '', '', 'ToggleDarkmode'); + showModalWarning('', '', + '', '', 'ToggleDarkmode'); } // -------------------------------------------------------- @@ -727,8 +697,8 @@ function logManage(callback) { targetLogFile = arguments[0]; // target logFileAction = arguments[1]; // action // Ask - showModalWarning('' + ' ' + arguments[1], '', - '', '', "performLogManage"); + showModalWarning('' + ' ' + arguments[1], '', + '', '', "performLogManage"); } // -------------------------------------------------------- diff --git a/front/network.php b/front/network.php index 00b132b9..e5d7ba2a 100755 --- a/front/network.php +++ b/front/network.php @@ -1,8 +1,6 @@ Online'); @@ -20,7 +18,7 @@

- +

diff --git a/front/php/server/db.php b/front/php/server/db.php index 551db721..69a9a4bd 100755 --- a/front/php/server/db.php +++ b/front/php/server/db.php @@ -8,11 +8,9 @@ # Puche 2021 / 2022+ jokob jokob@duck.com GNU GPLv3 //------------------------------------------------------------------------------ -require '/home/pi/pialert/front/php/templates/timezone.php'; - //------------------------------------------------------------------------------ // DB File Path -$DBFILE = '/home/pi/pialert/db/pialert.db'; +$DBFILE = dirname(__FILE__).'/../../../db/pialert.db'; //------------------------------------------------------------------------------ // Connect DB @@ -74,6 +72,3 @@ function OpenDB (...$DBPath) { // # Open DB once and keep open // # Opening / closing DB frequently actually casues more issues OpenDB (); // main - - -?> \ No newline at end of file diff --git a/front/php/server/devices.php b/front/php/server/devices.php index b299179e..02d60215 100755 --- a/front/php/server/devices.php +++ b/front/php/server/devices.php @@ -9,10 +9,7 @@ //------------------------------------------------------------------------------ // External files - require '/home/pi/pialert/front/php/templates/timezone.php'; - require '/home/pi/pialert/front/php/templates/language/lang.php'; - require '/home/pi/pialert/front/php/server/db.php'; - require '/home/pi/pialert/front/php/server/util.php'; + require dirname(__FILE__).'/init.php'; //------------------------------------------------------------------------------ // Action selector diff --git a/front/php/server/events.php b/front/php/server/events.php index db9c0d15..ef51da4a 100755 --- a/front/php/server/events.php +++ b/front/php/server/events.php @@ -9,8 +9,7 @@ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // External files - require 'db.php'; - require 'util.php'; + require dirname(__FILE__).'/init.php'; //------------------------------------------------------------------------------ diff --git a/front/php/server/init.php b/front/php/server/init.php new file mode 100644 index 00000000..9af4ab70 --- /dev/null +++ b/front/php/server/init.php @@ -0,0 +1,5 @@ +Internal error.'; } -?> \ No newline at end of file diff --git a/front/php/server/parameters.php b/front/php/server/parameters.php index 9fdcca77..26c4dfde 100755 --- a/front/php/server/parameters.php +++ b/front/php/server/parameters.php @@ -11,8 +11,7 @@ //------------------------------------------------------------------------------ // External files - require 'db.php'; - require 'util.php'; + require dirname(__FILE__).'/init.php'; //------------------------------------------------------------------------------ diff --git a/front/php/server/util.php b/front/php/server/util.php index a051f540..4c7c4eb3 100755 --- a/front/php/server/util.php +++ b/front/php/server/util.php @@ -8,8 +8,8 @@ # Puche 2021 / 2022+ jokob jokob@duck.com GNU GPLv3 //------------------------------------------------------------------------------ -require '/home/pi/pialert/front/php/templates/timezone.php'; -require '/home/pi/pialert/front/php/templates/skinUI.php'; +require dirname(__FILE__).'/../templates/timezone.php'; +require dirname(__FILE__).'/../templates/skinUI.php'; $FUNCTION = []; $SETTINGS = []; diff --git a/front/php/templates/graph.php b/front/php/templates/graph.php index a398f909..5a87078b 100755 --- a/front/php/templates/graph.php +++ b/front/php/templates/graph.php @@ -1,7 +1,5 @@ \ No newline at end of file diff --git a/front/php/templates/header.php b/front/php/templates/header.php index e187a0be..71e8f51a 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -8,10 +8,8 @@ #--------------------------------------------------------------------------- --> @@ -169,8 +167,8 @@ if ($ENABLED_DARKMODE === True) {
  • Pi.Alert Logo

    - - Raspberry Pi + + Raspberry Pi

  • @@ -178,7 +176,7 @@ if ($ENABLED_DARKMODE === True) { @@ -209,31 +207,31 @@ if ($ENABLED_DARKMODE === True) { diff --git a/front/php/templates/language/en_us.php b/front/php/templates/language/en_us.php index 139c6371..30deb2af 100755 --- a/front/php/templates/language/en_us.php +++ b/front/php/templates/language/en_us.php @@ -47,12 +47,12 @@ $lang['en_us'] = array( // Device Page ////////////////////////////////////////////////////////////////// -'Navigation_Devices' => ' Devices', -'Navigation_Presence' => ' Presence', +'Navigation_Devices' => 'Devices', +'Navigation_Presence' => 'Presence', 'Navigation_Events' => 'Events', 'Navigation_Maintenance' => 'Maintenance', 'Navigation_Settings' => 'Settings', -'Navigation_Network' => ' Network', +'Navigation_Network' => 'Network', 'Navigation_HelpFAQ' => 'Help / FAQ', 'Device_Title' => 'Devices', 'Device_Shortcut_AllDevices' => 'All Devices', @@ -513,6 +513,8 @@ the arp-scan will take hours to complete instead of seconds. 'REPORT_DASHBOARD_URL_description' => 'This URL is used as the base for generating links in the emails. Enter full URL starting with http:// including the port number (no trailig slash /).', 'DIG_GET_IP_ARG_name' => 'Internet IP discovery', 'DIG_GET_IP_ARG_description' => 'Change the dig utility arguments if you have issues resolving your Internet IP. Arguments are added at the end of the following command: dig +short .', +'UI_LANG_name' => 'Select Language', +'UI_LANG_description' => '', //Email 'Email_settings_group' => ' Email', diff --git a/front/php/templates/language/es_es.php b/front/php/templates/language/es_es.php index e84e0520..63384ea2 100755 --- a/front/php/templates/language/es_es.php +++ b/front/php/templates/language/es_es.php @@ -46,7 +46,7 @@ $lang['es_es'] = array( 'Navigation_Devices' => 'Dispositivos', 'Navigation_Presence' => 'Historial', 'Navigation_Events' => 'Eventos', -'Navigation_Maintenance' => 'Cantenimiento', +'Navigation_Maintenance' => 'Mantenimiento', 'Navigation_Settings' => 'Configuración', 'Navigation_Network' => 'Red', 'Navigation_HelpFAQ' => 'Ayuda / FAQ', diff --git a/front/php/templates/language/lang.php b/front/php/templates/language/lang.php index b7db137d..4b0d404b 100755 --- a/front/php/templates/language/lang.php +++ b/front/php/templates/language/lang.php @@ -6,18 +6,21 @@ $defaultLang = "en_us"; -if(!isset($_COOKIE["language"])) { - $pia_lang_selected = $defaultLang; -} else { - $pia_lang_selected = $_COOKIE["language"]; +global $db; + +$result = $db->querySingle("SELECT Value FROM Settings WHERE Code_Name = 'UI_LANG'"); +switch($result){ + case 'Spanish': $pia_lang_selected = 'es_es'; break; + case 'German': $pia_lang_selected = 'de_de'; break; + default: $pia_lang_selected = 'en_us'; break; } -if (isset($pia_lang_selected) == FALSE or (strlen($pia_lang_selected) == 0)) {$pia_lang_selected = defaultLang;} +if (isset($pia_lang_selected) == FALSE or (strlen($pia_lang_selected) == 0)) {$pia_lang_selected = $defaultLang;} -require '/home/pi/pialert/front/php/templates/skinUI.php'; -require 'en_us.php'; -require 'de_de.php'; -require 'es_es.php'; +require dirname(__FILE__).'/../skinUI.php'; +require dirname(__FILE__).'/en_us.php'; +require dirname(__FILE__).'/de_de.php'; +require dirname(__FILE__).'/es_es.php'; function lang($key) { @@ -45,4 +48,3 @@ function lang($key) return $temp; } -?> \ No newline at end of file diff --git a/front/php/templates/timezone.php b/front/php/templates/timezone.php index 63fc9e4d..5f754cd2 100755 --- a/front/php/templates/timezone.php +++ b/front/php/templates/timezone.php @@ -4,9 +4,9 @@ // ## TimeZone processing start // ################################### -$configFolderPath = "/home/pi/pialert/config/"; +$configFolderPath = dirname(__FILE__)."/../../../config/"; $config_file = "pialert.conf"; -$logFolderPath = "/home/pi/pialert/front/log/"; +$logFolderPath = dirname(__FILE__)."/../../log/"; $log_file = "pialert_front.log"; @@ -40,5 +40,3 @@ $timestamp = $date->format('Y-m-d_H-i-s'); // ################################### // ## TimeZone processing end // ################################### - -?> \ No newline at end of file diff --git a/front/presence.php b/front/presence.php index 49f5d0bd..e45b1b90 100755 --- a/front/presence.php +++ b/front/presence.php @@ -18,7 +18,7 @@

    - +

    @@ -32,7 +32,7 @@

    --

    -

    +

    @@ -44,7 +44,7 @@

    --

    -

    +

    @@ -56,7 +56,7 @@

    --

    -

    +

    @@ -68,7 +68,7 @@

    --

    -

    +

    @@ -80,7 +80,7 @@

    --

    -

    +

    @@ -92,7 +92,7 @@

    --

    -

    +

    @@ -106,7 +106,7 @@
    -

    +

    @@ -242,12 +242,12 @@ function initializeCalendar () { allDaySlot : false, timeFormat : 'H:mm', - resourceLabelText : '', + resourceLabelText : '', resourceAreaWidth : '160px', slotWidth : '1px', resourceOrder : '-favorite,title', - locale : '', + locale : '', //schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source', @@ -256,7 +256,7 @@ function initializeCalendar () { timelineYear: { type : 'timeline', duration : { year: 1 }, - buttonText : '', + buttonText : '', slotLabelFormat : 'MMM', // Hack to show partial day events not as fullday events slotDuration : {minutes: 44641} @@ -265,7 +265,7 @@ function initializeCalendar () { timelineQuarter: { type : 'timeline', duration : { month: 3 }, - buttonText : '', + buttonText : '', slotLabelFormat : 'MMM', // Hack to show partial day events not as fullday events slotDuration : {minutes: 44641} @@ -274,7 +274,7 @@ function initializeCalendar () { timelineMonth: { type : 'timeline', duration : { month: 1 }, - buttonText : '', + buttonText : '', slotLabelFormat : 'D', // Hack to show partial day events not as fullday events slotDuration : '24:00:01' @@ -283,7 +283,7 @@ function initializeCalendar () { timelineWeek: { type : 'timeline', duration : { week: 1 }, - buttonText : '', + buttonText : '', slotLabelFormat : 'D', slotDuration : '24:00:01' } @@ -361,13 +361,13 @@ function getDevicesPresence (status) { // Defini 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/settings.php b/front/settings.php index bd3078d8..565b9e9c 100755 --- a/front/settings.php +++ b/front/settings.php @@ -2,12 +2,6 @@ require 'php/templates/header.php'; - -//------------------------------------------------------------------------------ -// External files -require 'php/server/db.php'; -require 'php/server/util.php'; - //------------------------------------------------------------------------------ // Action selector //------------------------------------------------------------------------------ @@ -49,14 +43,14 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {

    - +

    -
    +
    fetchArray (SQLITE3_ASSOC)) {
    - +
    @@ -285,12 +279,12 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {