much more logging for the pholus issue + settings check

This commit is contained in:
Jokob-sk
2023-01-01 23:27:40 +11:00
parent 7aa61e142e
commit e77e1d5503
7 changed files with 108 additions and 33 deletions

View File

@@ -1785,11 +1785,4 @@ function reloadTab()
}
function sanitize(data)
{
return data.replace(/(\r\n|\n|\r)/gm,"").replace(/[^\x00-\x7F]/g, "")
}
</script>

View File

@@ -30,6 +30,9 @@ if (( isset ($_SESSION["login"]) && ($_SESSION["login"] == 1)) || (isset ($_COOK
$login_headline = lang('Login_Toggle_Info_headline');
$login_info = "";
$login_mode = 'danger';
$login_display_mode = 'display: block;';
$login_icon = 'fa-info';
// no active session, cookie not checked
if (isset ($_SESSION["login"]) == FALSE || $_SESSION["login"] != 1)

View File

@@ -151,6 +151,13 @@ function modalWarningOK () {
}, 100);
}
// -----------------------------------------------------------------------------
function sanitize(data)
{
return data.replace(/(\r\n|\n|\r)/gm,"").replace(/[^\x00-\x7F]/g, "")
}
// -----------------------------------------------------------------------------
function showMessage (textMessage="") {
if (textMessage.toLowerCase().includes("error") ) {

View File

@@ -425,7 +425,9 @@ $lang['en_us'] = array(
//////////////////////////////////////////////////////////////////
'settings_missing' => 'Not all settings loaded, refresh the page!',
'settings_missing' => 'Not all settings loaded, refresh the page! This is probably caused by a high load on the database.',
'settings_missing_block' => 'You can\'t save your settings without specifying all setting keys. Refresh the page. This is probably caused by a high load on the database.',
'settings_old' => 'The settings in the DB (shown on this page) are outdated. This is probably caused by a running scan. The settings were saved, but the background process didn\'t have time to import it yet. You can wait until the settings get refreshed so you don\'t overwrite your old values. Feel free to save your settings either way if you don\'t mind losing the settings between the last save and now. There are also backup files created if you need to compare your settings later.',
//General
'SCAN_SUBNETS_name' => 'Subnets to scan',

View File

@@ -51,7 +51,7 @@ CommitDB();
<h1 id="pageTitle">
<?php echo lang('Navigation_Settings');?>
</h1>
<span id="lastImportedTime"></span>
Last time imported from the pialert.conf file: <span id="lastImportedTime"></span>
</section>
<div class="content">
<?php
@@ -252,28 +252,10 @@ CommitDB();
// Wrong number of settings processing
if(<?php echo count($settings)?> != settingsNumber)
{
showModalOk('WARNING', '<?php echo lang("settings_missing")?>');
showModalOk('WARNING', "<?php echo lang("settings_missing")?>");
}
// ---------------------------------------------------------
function getParam(targetId, key, skipCache = false) {
skipCacheQuery = "";
if(skipCache)
{
skipCacheQuery = "&skipcache";
}
// get parameter value
$.get('php/server/parameters.php?action=get&parameter='+ key + skipCacheQuery, function(data) {
var result = data;
document.getElementById(targetId).innerHTML = result.replaceAll('"', '');
});
}
// ---------------------------------------------------------
function addInterface()
@@ -344,7 +326,7 @@ CommitDB();
function saveSettings() {
if(<?php echo count($settings)?> != settingsNumber)
{
showModalOk('WARNING', '<?php echo lang("settings_missing")?>');
showModalOk('WARNING', "<?php echo lang("settings_missing_block")?>");
} else
{
$.ajax({
@@ -359,6 +341,47 @@ CommitDB();
});
}
}
// ---------------------------------------------------------
function getParam(targetId, key, skipCache = false, callback) {
skipCacheQuery = "";
if(skipCache)
{
skipCacheQuery = "&skipcache";
}
// get parameter value
$.get('php/server/parameters.php?action=get&parameter='+ key + skipCacheQuery, function(data, callback) {
var result = data;
if(key == "Back_Settings_Imported")
{
fileModificationTime = <?php echo filemtime($confPath)*1000;?>;
importedMiliseconds = parseInt(result.match( /\d+/g ).join('')); // sanitize the string and get only the numbers
result = (new Date(importedMiliseconds)).toLocaleString("en-UK", { timeZone: "<?php echo $timeZone?>" }); //.toDateString("");
// check if displayed settings are outdated
if(fileModificationTime > importedMiliseconds)
{
showModalOk('WARNING: Outdated settings displayed', "<?php echo lang("settings_old")?>");
}
} else{
result = result.replaceAll('"', '');
}
document.getElementById(targetId).innerHTML = result;
});
}
// ---------------------------------------------------------
</script>
<script defer>
@@ -369,4 +392,5 @@ CommitDB();
</script>