system: move settings as per #2279

Not the perfect spot either as this is for gateway groups
now but still better than firewall and actually the original
spot where the setting could be found.
This commit is contained in:
Franco Fichtner 2018-12-03 08:40:42 +01:00
parent d8da4890fe
commit 723d97bbdf
2 changed files with 57 additions and 56 deletions

View File

@ -55,9 +55,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['schedule_states'] = isset($config['system']['schedule_states']);
$pconfig['kill_states'] = isset($config['system']['kill_states']);
$pconfig['skip_rules_gw_down'] = isset($config['system']['skip_rules_gw_down']);
$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']);
$pconfig['gw_switch_group4'] = isset($config['system']['gw_switch_group4']) ? $config['system']['gw_switch_group4'] : null;
$pconfig['gw_switch_group6'] = isset($config['system']['gw_switch_group6']) ? $config['system']['gw_switch_group6'] : null;
$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
$pconfig['pf_share_forward'] = isset($config['system']['pf_share_forward']);
$pconfig['pf_disable_force_gw'] = isset($config['system']['pf_disable_force_gw']);
@ -219,24 +216,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['skip_rules_gw_down']);
}
if (!empty($pconfig['gw_switch_default'])) {
$config['system']['gw_switch_default'] = true;
} elseif (isset($config['system']['gw_switch_default'])) {
unset($config['system']['gw_switch_default']);
}
if (!empty($pconfig['gw_switch_group4'])) {
$config['system']['gw_switch_group4'] = $pconfig['gw_switch_group4'];
} elseif (isset($config['system']['gw_switch_group4'])) {
unset($config['system']['gw_switch_group4']);
}
if (!empty($pconfig['gw_switch_group6'])) {
$config['system']['gw_switch_group6'] = $pconfig['gw_switch_group6'];
} elseif (isset($config['system']['gw_switch_group6'])) {
unset($config['system']['gw_switch_group6']);
}
if (!empty($pconfig['ip_change_kill_states'])) {
$config['system']['ip_change_kill_states'] = true;
} elseif (isset($config['system']['ip_change_kill_states'])) {
@ -389,39 +368,6 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_gw_switch_default" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Gateway switching') ?></td>
<td>
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?= !empty($pconfig['gw_switch_default']) ? 'checked="checked"' : '' ?> />
<?=gettext("Allow default gateway switching"); ?>
<div class="hidden" data-for="help_for_gw_switch_default">
<?= gettext('If the link where the default gateway resides fails switch the default gateway to another available one.') ?>
<?= gettext('When using default gateway switching use any available gateway or select a specific gateway group.') ?>
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('IPv4 Gateway Group') ?></td>
<td>
<select name="gw_switch_group4" class="selectpicker">
<option value="" <?= empty($pconfig['gw_switch_group4']) ? 'selected="selected"' : '' ?>><?= gettext('Any available gateway') ?></option>
<?php foreach (config_read_array('gateways', 'gateway_group') as $gwgroup): ?>
<option value="<?= html_safe($gwgroup['name']) ?>" <?= $pconfig['gw_switch_group4'] == $gwgroup['name'] ? 'selected="selected"' : '' ?>><?= $gwgroup['name'] ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('IPv6 Gateway Group') ?></td>
<td>
<select name="gw_switch_group6" class="selectpicker">
<option value="" <?= empty($pconfig['gw_switch_group6']) ? 'selected="selected"' : '' ?>><?= gettext('Any available gateway') ?></option>
<?php foreach (config_read_array('gateways', 'gateway_group') as $gwgroup): ?>
<option value="<?= html_safe($gwgroup['name']) ?>" <?= $pconfig['gw_switch_group6'] == $gwgroup['name'] ? 'selected="selected"' : '' ?>><?= $gwgroup['name'] ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
</table>
</div>
<div class="content-box tab-content table-responsive __mb">

View File

@ -47,7 +47,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['language'] = $config['system']['language'];
$pconfig['prefer_ipv4'] = isset($config['system']['prefer_ipv4']);
$pconfig['theme'] = $config['theme'];
$pconfig['timezone'] = empty($config['system']['timezone']) ? 'Etc/UTC' : $config['system']['timezone'] ;
$pconfig['timezone'] = empty($config['system']['timezone']) ? 'Etc/UTC' : $config['system']['timezone'];
$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']);
$pconfig['gw_switch_group4'] = isset($config['system']['gw_switch_group4']) ? $config['system']['gw_switch_group4'] : null;
$pconfig['gw_switch_group6'] = isset($config['system']['gw_switch_group6']) ? $config['system']['gw_switch_group6'] : null;
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
$dnsname = "dns{$dnscounter}";
@ -148,6 +152,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['dnslocalhost']);
}
if (!empty($pconfig['gw_switch_default'])) {
$config['system']['gw_switch_default'] = true;
} elseif (isset($config['system']['gw_switch_default'])) {
unset($config['system']['gw_switch_default']);
}
if (!empty($pconfig['gw_switch_group4'])) {
$config['system']['gw_switch_group4'] = $pconfig['gw_switch_group4'];
} elseif (isset($config['system']['gw_switch_group4'])) {
unset($config['system']['gw_switch_group4']);
}
if (!empty($pconfig['gw_switch_group6'])) {
$config['system']['gw_switch_group6'] = $pconfig['gw_switch_group6'];
} elseif (isset($config['system']['gw_switch_group6'])) {
unset($config['system']['gw_switch_group6']);
}
$olddnsservers = $config['system']['dnsserver'];
$config['system']['dnsserver'] = array();
@ -155,7 +177,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
$dnsname="dns{$dnscounter}";
$dnsgwname="dns{$dnscounter}gw";
$olddnsgwname = !empty($config['system'][$dnsgwname]) ? $config['system'][$dnsgwname] : "none" ;
$olddnsgwname = !empty($config['system'][$dnsgwname]) ? $config['system'][$dnsgwname] : 'none';
if (!empty($pconfig[$dnsname])) {
$config['system']['dnsserver'][] = $pconfig[$dnsname];
@ -428,6 +450,39 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_gw_switch_default" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Gateway switching') ?></td>
<td>
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?= !empty($pconfig['gw_switch_default']) ? 'checked="checked"' : '' ?> />
<?=gettext("Allow default gateway switching"); ?>
<div class="hidden" data-for="help_for_gw_switch_default">
<?= gettext('If the link where the default gateway resides fails switch the default gateway to another available one.') ?>
<?= gettext('When using default gateway switching use any available gateway or select a specific gateway group below.') ?>
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('IPv4 gateway group') ?></td>
<td>
<select name="gw_switch_group4" class="selectpicker">
<option value="" <?= empty($pconfig['gw_switch_group4']) ? 'selected="selected"' : '' ?>><?= gettext('Any available gateway') ?></option>
<?php foreach (config_read_array('gateways', 'gateway_group') as $gwgroup): ?>
<option value="<?= html_safe($gwgroup['name']) ?>" <?= $pconfig['gw_switch_group4'] == $gwgroup['name'] ? 'selected="selected"' : '' ?>><?= $gwgroup['name'] ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('IPv6 gateway group') ?></td>
<td>
<select name="gw_switch_group6" class="selectpicker">
<option value="" <?= empty($pconfig['gw_switch_group6']) ? 'selected="selected"' : '' ?>><?= gettext('Any available gateway') ?></option>
<?php foreach (config_read_array('gateways', 'gateway_group') as $gwgroup): ?>
<option value="<?= html_safe($gwgroup['name']) ?>" <?= $pconfig['gw_switch_group6'] == $gwgroup['name'] ? 'selected="selected"' : '' ?>><?= $gwgroup['name'] ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
</table>
</div>
<div class="content-box tab-content">