code cleanup
This commit is contained in:
@@ -51,6 +51,8 @@ fullConfPath = pialertPath + confPath
|
|||||||
fullDbPath = pialertPath + dbPath
|
fullDbPath = pialertPath + dbPath
|
||||||
STOPARPSCAN = pialertPath + "/db/setting_stoparpscan"
|
STOPARPSCAN = pialertPath + "/db/setting_stoparpscan"
|
||||||
|
|
||||||
|
time_now = datetime.datetime.now()
|
||||||
|
log_timestamp = time_now
|
||||||
sql_connection = None
|
sql_connection = None
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +103,7 @@ def print_log (pText):
|
|||||||
log_timestamp2 = datetime.datetime.now()
|
log_timestamp2 = datetime.datetime.now()
|
||||||
|
|
||||||
# Print line + time + elapsed time + text
|
# Print line + time + elapsed time + text
|
||||||
file_print('[LOG_PRINT] ',
|
file_print('[PRINT_LOG] ',
|
||||||
log_timestamp2, ' ',
|
log_timestamp2, ' ',
|
||||||
log_timestamp2 - log_timestamp, ' ',
|
log_timestamp2 - log_timestamp, ' ',
|
||||||
pText)
|
pText)
|
||||||
@@ -469,8 +471,6 @@ check_report = [1, "internet_IP", "update_vendors_silent"]
|
|||||||
mqtt_thread_up = False
|
mqtt_thread_up = False
|
||||||
|
|
||||||
# timestamps of last execution times
|
# timestamps of last execution times
|
||||||
time_now = datetime.datetime.now()
|
|
||||||
log_timestamp = time_now
|
|
||||||
startTime = time_now
|
startTime = time_now
|
||||||
now_minus_24h = time_now - timedelta(hours = 24)
|
now_minus_24h = time_now - timedelta(hours = 24)
|
||||||
|
|
||||||
@@ -2560,7 +2560,7 @@ def upgradeDB ():
|
|||||||
""").fetchone() == None
|
""").fetchone() == None
|
||||||
|
|
||||||
# Re-creating Settings table
|
# Re-creating Settings table
|
||||||
if settingsMissing:
|
# if settingsMissing:
|
||||||
file_print("[upgradeDB] Re-creating Settings table")
|
file_print("[upgradeDB] Re-creating Settings table")
|
||||||
|
|
||||||
sql.execute("DROP TABLE Settings;")
|
sql.execute("DROP TABLE Settings;")
|
||||||
|
|||||||
@@ -10,69 +10,17 @@ if(array_search('action', $_REQUEST) != FALSE)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require 'php/templates/language/lang.php';
|
||||||
|
require 'php/templates/skinUI.php';
|
||||||
|
|
||||||
|
|
||||||
// ##################################################
|
// ##################################################
|
||||||
// ## Login Processing start
|
// ## Login Processing start
|
||||||
// ##################################################
|
// ##################################################
|
||||||
$config_file = "../config/pialert.conf";
|
$config_file = "../config/pialert.conf";
|
||||||
$config_file_lines = file($config_file);
|
$config_file_lines = file($config_file);
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing start
|
|
||||||
// ###################################
|
|
||||||
if (file_exists('../db/setting_darkmode')) {
|
|
||||||
$ENABLED_DARKMODE = True;
|
|
||||||
}
|
|
||||||
foreach (glob("../db/setting_skin*") as $filename) {
|
|
||||||
$pia_skin_selected = str_replace('setting_','',basename($filename));
|
|
||||||
}
|
|
||||||
if (isset($pia_skin_selected) == FALSE or (strlen($pia_skin_selected) == 0)) {$pia_skin_selected = 'skin-blue';}
|
|
||||||
|
|
||||||
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 '/home/pi/pialert/front/php/templates/language/'.$pia_lang_selected.'.php';
|
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing end
|
|
||||||
// ###################################
|
|
||||||
// ###################################
|
|
||||||
// ## 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
|
// ## PIALERT_WEB_PROTECTION FALSE
|
||||||
// ###################################
|
// ###################################
|
||||||
|
|||||||
@@ -146,32 +146,6 @@ if (submit && isset($_POST['skinselector_set'])) {
|
|||||||
|
|
||||||
// Language selector -----------------------------------------------------------------
|
// Language selector -----------------------------------------------------------------
|
||||||
|
|
||||||
if (submit && isset($_POST['langselector_set'])) {
|
|
||||||
$pia_lang_set_dir = '../db/';
|
|
||||||
$pia_lang_selector = htmlspecialchars($_POST['langselector']);
|
|
||||||
if (in_array($pia_lang_selector, $pia_installed_langs)) {
|
|
||||||
foreach ($pia_installed_langs as $file) {
|
|
||||||
unlink ($pia_lang_set_dir.'/setting_language_'.$file);
|
|
||||||
}
|
|
||||||
foreach ($pia_installed_langs as $file) {
|
|
||||||
if (file_exists($pia_lang_set_dir.'/setting_language_'.$file)) {
|
|
||||||
$pia_lang_error = True;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
$pia_lang_error = False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($pia_lang_error == False) {
|
|
||||||
$testlang = fopen($pia_lang_set_dir.'setting_language_'.$pia_lang_selector, 'w');
|
|
||||||
//$pia_lang_test = '';
|
|
||||||
echo("<meta http-equiv='refresh' content='1'>");
|
|
||||||
} else {
|
|
||||||
//$pia_lang_test = '';
|
|
||||||
echo("<meta http-equiv='refresh' content='1'>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -240,14 +214,12 @@ if (submit && isset($_POST['langselector_set'])) {
|
|||||||
<div class="db_tools_table_cell_a" style="text-align:center;">
|
<div class="db_tools_table_cell_a" style="text-align:center;">
|
||||||
<form method="post" action="maintenance.php">
|
<form method="post" action="maintenance.php">
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<select name="langselector" class="form-control bg-green" style="width:160px; margin-bottom:5px;">
|
<select name="langselector" id="langselector" class="form-control bg-green" style="width:160px; margin-bottom:5px;">
|
||||||
<option value=""><?php echo lang('Maintenance_lang_selector_empty');?></option>
|
<option value=""><?php echo lang('Maintenance_lang_selector_empty');?></option>
|
||||||
<option value="en_us"><?php echo lang('Maintenance_lang_en_us');?></option>
|
<option value="en_us"><?php echo lang('Maintenance_lang_en_us');?></option>
|
||||||
<option value="de_de"><?php echo lang('Maintenance_lang_de_de');?></option>
|
<option value="de_de"><?php echo lang('Maintenance_lang_de_de');?></option>
|
||||||
<option value="es_es"><?php echo lang('Maintenance_lang_es_es');?></option>
|
<option value="es_es"><?php echo lang('Maintenance_lang_es_es');?></option>
|
||||||
</select></div>
|
</select>
|
||||||
<div style="display: block;"><input type="submit" name="langselector_set" value="<?php echo lang('Maintenance_lang_selector_apply');?>" class="btn bg-green" style="width:160px;">
|
|
||||||
<?php // echo $pia_lang_test; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -722,6 +694,14 @@ function initializeTabs () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save language in a cookie
|
||||||
|
$('#langselector').on('change', function (e) {
|
||||||
|
var optionSelected = $("option:selected", this);
|
||||||
|
var valueSelected = this.value;
|
||||||
|
setCookie("language",valueSelected )
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// load footer asynchronously not to block the page load/other sections
|
// load footer asynchronously not to block the page load/other sections
|
||||||
window.onload = function asyncFooter()
|
window.onload = function asyncFooter()
|
||||||
|
|||||||
@@ -7,54 +7,11 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
// Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// ###################################
|
|
||||||
// ## TimeZone processing start
|
|
||||||
// ###################################
|
|
||||||
|
|
||||||
$configFolderPath = "/home/pi/pialert/config/";
|
|
||||||
$config_file = "pialert.conf";
|
|
||||||
$logFolderPath = "/home/pi/pialert/front/log/";
|
|
||||||
$log_file = "pialert_front.log";
|
|
||||||
|
|
||||||
|
|
||||||
$fullConfPath = $configFolderPath.$config_file;
|
|
||||||
|
|
||||||
$config_file_lines = file($fullConfPath);
|
|
||||||
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
|
|
||||||
|
|
||||||
$timeZone = "";
|
|
||||||
|
|
||||||
foreach ($config_file_lines as $line)
|
|
||||||
{
|
|
||||||
if( preg_match('/TIMEZONE(.*?)/', $line, $match) == 1 )
|
|
||||||
{
|
|
||||||
if (preg_match('/\'(.*?)\'/', $line, $match) == 1) {
|
|
||||||
$timeZone = $match[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($timeZone == "")
|
|
||||||
{
|
|
||||||
$timeZone = "Europe/Berlin";
|
|
||||||
}
|
|
||||||
|
|
||||||
date_default_timezone_set($timeZone);
|
|
||||||
|
|
||||||
$date = new DateTime("now", new DateTimeZone($timeZone) );
|
|
||||||
$timestamp = $date->format('Y-m-d_H-i-s');
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## TimeZone processing end
|
|
||||||
// ###################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// External files
|
// External files
|
||||||
require 'db.php';
|
require '/home/pi/pialert/front/php/templates/timezone.php';
|
||||||
require 'util.php';
|
require '/home/pi/pialert/front/php/server/db.php';
|
||||||
|
require '/home/pi/pialert/front/php/server/util.php';
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Action selector
|
// Action selector
|
||||||
|
|||||||
@@ -8,57 +8,10 @@
|
|||||||
// Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
// Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// ###################################
|
require '/home/pi/pialert/front/php/templates/timezone.php';
|
||||||
// ## TimeZone processing start
|
require '/home/pi/pialert/front/php/templates/skinUI.php';
|
||||||
// ###################################
|
|
||||||
$configFolderPath = "/home/pi/pialert/config/";
|
|
||||||
$config_file = "pialert.conf";
|
|
||||||
$logFolderPath = "/home/pi/pialert/front/log/";
|
|
||||||
$log_file = "pialert_front.log";
|
|
||||||
|
|
||||||
|
|
||||||
$fullConfPath = $configFolderPath.$config_file;
|
|
||||||
|
|
||||||
$config_file_lines = file($fullConfPath);
|
|
||||||
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
|
|
||||||
|
|
||||||
$timeZone = "";
|
|
||||||
|
|
||||||
foreach ($config_file_lines as $line)
|
|
||||||
{
|
|
||||||
if( preg_match('/TIMEZONE(.*?)/', $line, $match) == 1 )
|
|
||||||
{
|
|
||||||
if (preg_match('/\'(.*?)\'/', $line, $match) == 1) {
|
|
||||||
$timeZone = $match[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($timeZone == "")
|
|
||||||
{
|
|
||||||
$timeZone = "Europe/Berlin";
|
|
||||||
}
|
|
||||||
|
|
||||||
date_default_timezone_set($timeZone);
|
|
||||||
|
|
||||||
$date = new DateTime("now", new DateTimeZone($timeZone) );
|
|
||||||
$timestamp = $date->format('Y-m-d_H-i-s');
|
|
||||||
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## TimeZone processing end
|
|
||||||
// ###################################
|
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing start
|
|
||||||
// ###################################
|
|
||||||
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 '/home/pi/pialert/front/php/templates/language/'.$pia_lang_selected.'.php';
|
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing end
|
|
||||||
// ###################################
|
|
||||||
$FUNCTION = [];
|
$FUNCTION = [];
|
||||||
$SETTINGS = [];
|
$SETTINGS = [];
|
||||||
|
|
||||||
|
|||||||
@@ -8,101 +8,11 @@
|
|||||||
#--------------------------------------------------------------------------- -->
|
#--------------------------------------------------------------------------- -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// ###################################
|
|
||||||
// ## TimeZone processing start
|
|
||||||
// ###################################
|
|
||||||
|
|
||||||
$configFolderPath = "/home/pi/pialert/config/";
|
require '/home/pi/pialert/front/php/templates/timezone.php';
|
||||||
$config_file = "pialert.conf";
|
require '/home/pi/pialert/front/php/templates/skinUI.php';
|
||||||
$logFolderPath = "/home/pi/pialert/front/log/";
|
require '/home/pi/pialert/front/php/templates/language/lang.php';
|
||||||
$log_file = "pialert_front.log";
|
|
||||||
|
|
||||||
|
|
||||||
$fullConfPath = $configFolderPath.$config_file;
|
|
||||||
|
|
||||||
$config_file_lines = file($fullConfPath);
|
|
||||||
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
|
|
||||||
|
|
||||||
$timeZone = "";
|
|
||||||
|
|
||||||
foreach ($config_file_lines as $line)
|
|
||||||
{
|
|
||||||
if( preg_match('/TIMEZONE(.*?)/', $line, $match) == 1 )
|
|
||||||
{
|
|
||||||
if (preg_match('/\'(.*?)\'/', $line, $match) == 1) {
|
|
||||||
$timeZone = $match[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($timeZone == "")
|
|
||||||
{
|
|
||||||
$timeZone = "Europe/Berlin";
|
|
||||||
}
|
|
||||||
|
|
||||||
date_default_timezone_set($timeZone);
|
|
||||||
|
|
||||||
$date = new DateTime("now", new DateTimeZone($timeZone) );
|
|
||||||
$timestamp = $date->format('Y-m-d_H-i-s');
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## TimeZone processing end
|
|
||||||
// ###################################
|
|
||||||
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing start
|
|
||||||
// ###################################
|
|
||||||
if (file_exists('../db/setting_darkmode')) {
|
|
||||||
$ENABLED_DARKMODE = True;
|
|
||||||
}
|
|
||||||
foreach (glob("../db/setting_skin*") as $filename) {
|
|
||||||
$pia_skin_selected = str_replace('setting_','',basename($filename));
|
|
||||||
}
|
|
||||||
if (isset($pia_skin_selected) == FALSE or (strlen($pia_skin_selected) == 0)) {$pia_skin_selected = 'skin-blue';}
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ###################################
|
|
||||||
// ## GUI settings processing end
|
|
||||||
// ###################################
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ $lang['de_de'] = array(
|
|||||||
'DevDetail_Nmap_buttonDetail_text' => 'Detailierter Scan: Standardscan mit aktivierter Betriebssystemerkennung, Versionserkennung, Skript-Scan und Traceroute (bis zu 30 oder mehr Sekunden)',
|
'DevDetail_Nmap_buttonDetail_text' => 'Detailierter Scan: Standardscan mit aktivierter Betriebssystemerkennung, Versionserkennung, Skript-Scan und Traceroute (bis zu 30 oder mehr Sekunden)',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery' => 'Ohne Erreichbarkeitsprüfung',
|
'DevDetail_Nmap_buttonSkipDiscovery' => 'Ohne Erreichbarkeitsprüfung',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Ohne Erreichbarkeitsprüfung (-Pn Parameter): Standard Scan bei dem nmap annimmt, dass der Host erreichbar ist.',
|
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Ohne Erreichbarkeitsprüfung (-Pn Parameter): Standard Scan bei dem nmap annimmt, dass der Host erreichbar ist.',
|
||||||
'DevDetail_Nmap_resultsLink' => 'Results will be also available in the <code>pialert_front.log</code> file.',
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Maintenance Page
|
// Maintenance Page
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ $lang['en_us'] = array(
|
|||||||
'DevDetail_Nmap_buttonDetail_text' => 'Detailed Scan: Default scan with enabled OS detection, version detection, script scanning and traceroute (up to 30 seconds or more)',
|
'DevDetail_Nmap_buttonDetail_text' => 'Detailed Scan: Default scan with enabled OS detection, version detection, script scanning and traceroute (up to 30 seconds or more)',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery' => 'Skip host discovery',
|
'DevDetail_Nmap_buttonSkipDiscovery' => 'Skip host discovery',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Skip host discovery (-Pn option): Default scan without host discovery',
|
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Skip host discovery (-Pn option): Default scan without host discovery',
|
||||||
'DevDetail_Nmap_resultsLink' => 'Results will be also available in the <code>pialert_front.log</code> file.',
|
'DevDetail_Nmap_resultsLink' => 'You can leave this page after starting a scan. Results will be also available in the <code>pialert_front.log</code> file.',
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Maintenance Page
|
// Maintenance Page
|
||||||
@@ -212,7 +212,7 @@ $lang['en_us'] = array(
|
|||||||
'Maintenance_Title' => 'Maintenance tools',
|
'Maintenance_Title' => 'Maintenance tools',
|
||||||
'Maintenance_database_path' => 'Database-Path',
|
'Maintenance_database_path' => 'Database-Path',
|
||||||
'Maintenance_database_size' => 'Database-Size',
|
'Maintenance_database_size' => 'Database-Size',
|
||||||
'Maintenance_database_lastmod' => 'last Modification',
|
'Maintenance_database_lastmod' => 'Last Modification',
|
||||||
'Maintenance_database_backup' => 'DB Backups',
|
'Maintenance_database_backup' => 'DB Backups',
|
||||||
'Maintenance_database_backup_found' => 'backups were found',
|
'Maintenance_database_backup_found' => 'backups were found',
|
||||||
'Maintenance_database_backup_total' => 'total disk usage',
|
'Maintenance_database_backup_total' => 'total disk usage',
|
||||||
@@ -228,7 +228,7 @@ $lang['en_us'] = array(
|
|||||||
'Maintenance_lang_en_us' => 'English (US)',
|
'Maintenance_lang_en_us' => 'English (US)',
|
||||||
'Maintenance_lang_de_de' => 'German (DE)',
|
'Maintenance_lang_de_de' => 'German (DE)',
|
||||||
'Maintenance_lang_es_es' => 'Spanish (ES)',
|
'Maintenance_lang_es_es' => 'Spanish (ES)',
|
||||||
'Maintenance_lang_selector_text' => 'The change takes place on the server side, so it affects all devices in use.',
|
'Maintenance_lang_selector_text' => 'The change takes place on the client side, so it affects only the current browser.',
|
||||||
'Maintenance_lang_selector_apply' => 'Apply',
|
'Maintenance_lang_selector_apply' => 'Apply',
|
||||||
'Maintenance_Tools_Tab_Settings' => 'Settings',
|
'Maintenance_Tools_Tab_Settings' => 'Settings',
|
||||||
'Maintenance_Tools_Tab_Tools' => 'Tools',
|
'Maintenance_Tools_Tab_Tools' => 'Tools',
|
||||||
@@ -422,6 +422,9 @@ $lang['en_us'] = array(
|
|||||||
// Settings
|
// Settings
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
'settings_missing' => 'Not all settings loaded, refresh the page!',
|
||||||
|
|
||||||
//General
|
//General
|
||||||
'SCAN_SUBNETS_name' => 'Subnets to scan',
|
'SCAN_SUBNETS_name' => 'Subnets to scan',
|
||||||
'SCAN_SUBNETS_description' => '
|
'SCAN_SUBNETS_description' => '
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ $lang['es_es'] = array(
|
|||||||
'Navigation_Presence' => 'Historial',
|
'Navigation_Presence' => 'Historial',
|
||||||
'Navigation_Events' => 'Eventos',
|
'Navigation_Events' => 'Eventos',
|
||||||
'Navigation_Maintenance' => 'Cantenimiento',
|
'Navigation_Maintenance' => 'Cantenimiento',
|
||||||
'Navigation_Settings' => 'configuración',
|
'Navigation_Settings' => 'Configuración',
|
||||||
'Navigation_Network' => 'Red',
|
'Navigation_Network' => 'Red',
|
||||||
'Navigation_HelpFAQ' => 'Ayuda / FAQ',
|
'Navigation_HelpFAQ' => 'Ayuda / FAQ',
|
||||||
'Device_Title' => 'Dispositivos',
|
'Device_Title' => 'Dispositivos',
|
||||||
@@ -199,7 +199,6 @@ $lang['es_es'] = array(
|
|||||||
'DevDetail_Nmap_buttonDetail_text' => 'Escaneo detallado: escaneo predeterminado con detección de sistema operativo habilitado, detección de versiones, escaneo de script y traceroute (hasta 30 segundos o más)',
|
'DevDetail_Nmap_buttonDetail_text' => 'Escaneo detallado: escaneo predeterminado con detección de sistema operativo habilitado, detección de versiones, escaneo de script y traceroute (hasta 30 segundos o más)',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery' => 'Omitir detección de host',
|
'DevDetail_Nmap_buttonSkipDiscovery' => 'Omitir detección de host',
|
||||||
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Omitir detección de host (-Pn opción): Escaneo predeterminado sin detección de host',
|
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Omitir detección de host (-Pn opción): Escaneo predeterminado sin detección de host',
|
||||||
'DevDetail_Nmap_resultsLink' => 'Results will be also available in the <code>pialert_front.log</code> file.',
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Maintenance Page - Update by @TeroRERO 07ago2022
|
// Maintenance Page - Update by @TeroRERO 07ago2022
|
||||||
|
|||||||
43
front/php/templates/language/lang.php
Normal file
43
front/php/templates/language/lang.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// ###################################
|
||||||
|
// ## Languages
|
||||||
|
// ###################################
|
||||||
|
|
||||||
|
if(!isset($_COOKIE["language"])) {
|
||||||
|
$pia_lang_selected = "en_us";
|
||||||
|
} else {
|
||||||
|
$pia_lang_selected = $_COOKIE["language"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($pia_lang_selected) == FALSE or (strlen($pia_lang_selected) == 0)) {$pia_lang_selected = 'en_us';}
|
||||||
|
|
||||||
|
require 'en_us.php';
|
||||||
|
require 'de_de.php';
|
||||||
|
require '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;
|
||||||
|
}
|
||||||
|
?>
|
||||||
19
front/php/templates/skinUI.php
Normal file
19
front/php/templates/skinUI.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// ###################################
|
||||||
|
// ## GUI settings processing start
|
||||||
|
// ###################################
|
||||||
|
|
||||||
|
if (file_exists('/home/pi/pialert/db/setting_darkmode')) {
|
||||||
|
$ENABLED_DARKMODE = True;
|
||||||
|
}
|
||||||
|
foreach (glob("/home/pi/pialert/db/setting_skin*") as $filename) {
|
||||||
|
$pia_skin_selected = str_replace('setting_','',basename($filename));
|
||||||
|
}
|
||||||
|
if (isset($pia_skin_selected) == FALSE or (strlen($pia_skin_selected) == 0)) {$pia_skin_selected = 'skin-blue';}
|
||||||
|
|
||||||
|
// ###################################
|
||||||
|
// ## GUI settings processing end
|
||||||
|
// ###################################
|
||||||
|
|
||||||
|
?>
|
||||||
44
front/php/templates/timezone.php
Normal file
44
front/php/templates/timezone.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// ###################################
|
||||||
|
// ## TimeZone processing start
|
||||||
|
// ###################################
|
||||||
|
|
||||||
|
$configFolderPath = "/home/pi/pialert/config/";
|
||||||
|
$config_file = "pialert.conf";
|
||||||
|
$logFolderPath = "/home/pi/pialert/front/log/";
|
||||||
|
$log_file = "pialert_front.log";
|
||||||
|
|
||||||
|
|
||||||
|
$fullConfPath = $configFolderPath.$config_file;
|
||||||
|
|
||||||
|
$config_file_lines = file($fullConfPath);
|
||||||
|
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
|
||||||
|
|
||||||
|
$timeZone = "";
|
||||||
|
|
||||||
|
foreach ($config_file_lines as $line)
|
||||||
|
{
|
||||||
|
if( preg_match('/TIMEZONE(.*?)/', $line, $match) == 1 )
|
||||||
|
{
|
||||||
|
if (preg_match('/\'(.*?)\'/', $line, $match) == 1) {
|
||||||
|
$timeZone = $match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($timeZone == "")
|
||||||
|
{
|
||||||
|
$timeZone = "Europe/Berlin";
|
||||||
|
}
|
||||||
|
|
||||||
|
date_default_timezone_set($timeZone);
|
||||||
|
|
||||||
|
$date = new DateTime("now", new DateTimeZone($timeZone) );
|
||||||
|
$timestamp = $date->format('Y-m-d_H-i-s');
|
||||||
|
|
||||||
|
// ###################################
|
||||||
|
// ## TimeZone processing end
|
||||||
|
// ###################################
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -19,9 +19,6 @@ if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
|
|||||||
// External files
|
// External files
|
||||||
require 'php/server/db.php';
|
require 'php/server/db.php';
|
||||||
require 'php/server/util.php';
|
require 'php/server/util.php';
|
||||||
require 'php/templates/language/'.$pia_lang_selected.'.php';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Action selector
|
// Action selector
|
||||||
@@ -47,8 +44,7 @@ $result = $db->query("SELECT * FROM Settings");
|
|||||||
$settings = array();
|
$settings = array();
|
||||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||||
// Push row data
|
// Push row data
|
||||||
$settings[] = array( 'Index' => $row['Index'],
|
$settings[] = array( 'Code_Name' => $row['Code_Name'],
|
||||||
'Code_Name' => $row['Code_Name'],
|
|
||||||
'Display_Name' => $row['Display_Name'],
|
'Display_Name' => $row['Display_Name'],
|
||||||
'Description' => $row['Description'],
|
'Description' => $row['Description'],
|
||||||
'Type' => $row['Type'],
|
'Type' => $row['Type'],
|
||||||
@@ -61,6 +57,8 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
echo "<script>if(".count($settings)." != 46)alert('".lang("settings_missing")."')</script>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- Page ------------------------------------------------------------------ -->
|
<!-- Page ------------------------------------------------------------------ -->
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
|
|||||||
Reference in New Issue
Block a user