mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
settings rewrite to JS + metadata work + #298 work
This commit is contained in:
@@ -259,68 +259,27 @@ function saveSettings()
|
||||
$txt = $txt."#-----------------AUTOGENERATED FILE-----------------#\n";
|
||||
|
||||
// collect all groups
|
||||
foreach ($SETTINGS as $setting) {
|
||||
|
||||
$decodedSettings = json_decode($SETTINGS, true);
|
||||
|
||||
foreach ($decodedSettings as $setting) {
|
||||
if( in_array($setting[0] , $groups) == false) {
|
||||
array_push($groups ,$setting[0]);
|
||||
}
|
||||
}
|
||||
|
||||
echo "--SETTINGS<br>";
|
||||
echo count($SETTINGS);
|
||||
echo "--SETTINGS session<br>";
|
||||
echo count($_SESSION['pia_settingsArray']); //pia_settingsArray
|
||||
echo "--SETTINGS session<br>";
|
||||
echo $_SESSION['pia_settingsArray']; //pia_settingsArray
|
||||
|
||||
$index = 0;
|
||||
foreach($SETTINGS as $setting)
|
||||
{
|
||||
if(count($setting) < 3)
|
||||
{
|
||||
echo "--PREV<br>";
|
||||
echo json_encode($SETTINGS[$index -1]);
|
||||
echo "--<br>";
|
||||
echo json_encode($setting);
|
||||
echo "--<br>";
|
||||
echo count($setting);
|
||||
echo "--NEXT<br>";
|
||||
echo json_encode($SETTINGS[$index +1]);
|
||||
echo "--<br>";
|
||||
}
|
||||
|
||||
$index = $index +1;
|
||||
}
|
||||
|
||||
|
||||
// go thru the groups and prepare settings to write to file
|
||||
foreach($groups as $group)
|
||||
{
|
||||
$txt = $txt."\n\n# ".$group;
|
||||
$txt = $txt."\n#---------------------------\n" ;
|
||||
|
||||
$index = 0;
|
||||
foreach($SETTINGS as $setting)
|
||||
|
||||
foreach($decodedSettings as $setting)
|
||||
{
|
||||
$index = $index +1;
|
||||
|
||||
if($group == $setting[0])
|
||||
{
|
||||
// if (count($setting) < 3)
|
||||
if ($index == 248)
|
||||
{
|
||||
echo json_encode($index-1);
|
||||
echo json_encode($setting[0]);
|
||||
echo json_encode($setting[1]);
|
||||
}
|
||||
|
||||
if (count($setting) < 3)
|
||||
// if ($index == 248)
|
||||
{
|
||||
echo "<br>----------------<br>";
|
||||
echo json_encode($index-1);
|
||||
echo json_encode($setting[0]);
|
||||
echo json_encode($setting[1]);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
|
||||
if($setting[2] == 'text' or $setting[2] == 'password' or $setting[2] == 'readonly' or $setting[2] == 'text.select')
|
||||
@@ -330,10 +289,10 @@ function saveSettings()
|
||||
} elseif($setting[2] == 'integer' or $setting[2] == 'integer.select')
|
||||
{
|
||||
$txt = $txt.$setting[1]."=".$setting[3]."\n" ;
|
||||
} elseif($setting[2] == 'boolean')
|
||||
} elseif($setting[2] == 'boolean' || $setting[2] == 'integer.checkbox')
|
||||
{
|
||||
$val = "False";
|
||||
if($setting[3] == 'true')
|
||||
if($setting[3] == 'true' || $setting[3] == '1' || $setting[3] == 1 || $setting[3] == 'True')
|
||||
{
|
||||
$val = "True";
|
||||
}
|
||||
@@ -368,7 +327,7 @@ function saveSettings()
|
||||
$txt = $txt."#-------------------IMPORTANT INFO-------------------#\n";
|
||||
|
||||
// open new file and write the new configuration
|
||||
$newConfig = fopen($fullConfPath, "w") or die("Unable to open file!");
|
||||
$newConfig = fopen($fullConfPath, "w") or die("Unable to open file!");
|
||||
fwrite($newConfig, $txt);
|
||||
fclose($newConfig);
|
||||
|
||||
|
||||
0
front/php/server/utilDB.php
Normal file → Executable file
0
front/php/server/utilDB.php
Normal file → Executable file
Reference in New Issue
Block a user