Update ajaxHelper.php

Remove debug code
Remove extraneous testing when saving permit / deny as now handled in helper functions
This commit is contained in:
stevenA 2022-01-28 09:02:02 +01:00
parent 24b2dd128c
commit 87f90be7b0

View file

@ -340,7 +340,6 @@ trait ajaxHelper {
foreach ($request as $key => $value) { foreach ($request as $key => $value) {
// First handle any arrays as their prefix is part common with normal data // First handle any arrays as their prefix is part common with normal data
//$netvalue = array();
$key = (str_replace($hdr_arprefix, '', $key, $count_mods)); $key = (str_replace($hdr_arprefix, '', $key, $count_mods));
if ($count_mods) { if ($count_mods) {
// Only arrays : network lists or ip lists. // Only arrays : network lists or ip lists.
@ -381,7 +380,6 @@ trait ajaxHelper {
} }
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings)); $extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
$save_settings = array_merge($save_settings, $extSettings); $save_settings = array_merge($save_settings, $extSettings);
//dbug($save_settings);
if (!empty($save_settings)) { if (!empty($save_settings)) {
//$this->saveSccpSettings($save_settings); //$this->saveSccpSettings($save_settings);
$this->dbinterface->write('sccpsettings', $save_settings, 'update'); $this->dbinterface->write('sccpsettings', $save_settings, 'update');
@ -587,6 +585,9 @@ trait ajaxHelper {
switch ($key) { switch ($key) {
case 'permit': case 'permit':
case 'deny'; case 'deny';
$this->convertArrayToCsv($netValue);
/*
// Now have an array of settings each with keys net and Mask // Now have an array of settings each with keys net and Mask
// TODO: This needs to be optimised // TODO: This needs to be optimised
//foreach ($valueArr as $netValue) { //foreach ($valueArr as $netValue) {
@ -596,15 +597,17 @@ trait ajaxHelper {
} }
if (isset($netValue['internal'])) { if (isset($netValue['internal'])) {
$output[] = 'internal'; $output[] = 'internal';
continue; continue 2;
} }
if (empty($netValue['net'])) { if (empty($netValue['net'])) {
// empty net so ignored // empty net so ignored
continue; continue 2;
} }
$netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask']; $netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask'];
$output[]= implode('/', $netValue); $output[]= implode('/', $netValue);
//} //}
*/
break; break;
case 'setvar': case 'setvar':
$output[] = implode(';', $netValue); $output[] = implode(';', $netValue);