Commit 01a83d07 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) more cleanups

parent 0017f80d
...@@ -249,6 +249,7 @@ if (file_exists('/var/run/booting')) { ...@@ -249,6 +249,7 @@ if (file_exists('/var/run/booting')) {
} }
if (is_array($config['hasync'])) { if (is_array($config['hasync'])) {
$sections = array();
update_filter_reload_status("Building high availability information"); update_filter_reload_status("Building high availability information");
$hasync = $config['hasync']; $hasync = $config['hasync'];
...@@ -273,59 +274,59 @@ if (is_array($config['hasync'])) { ...@@ -273,59 +274,59 @@ if (is_array($config['hasync'])) {
} }
if ($hasync['synchronizerules'] != "") { if (isset($hasync['synchronizerules'])) {
if (!is_array($config['filter'])) if (!is_array($config['filter']))
$config['filter'] = array(); $config['filter'] = array();
$sections[] = 'filter'; $sections[] = 'filter';
} }
if ($hasync['synchronizenat'] != "") { if (isset($hasync['synchronizenat'])) {
if (!is_array($config['nat'])) if (!is_array($config['nat']))
$config['nat'] = array(); $config['nat'] = array();
$sections[] = 'nat'; $sections[] = 'nat';
} }
if ($hasync['synchronizealiases'] != "") { if (isset($hasync['synchronizealiases'])) {
if (!is_array($config['aliases'])) if (!is_array($config['aliases']))
$config['aliases'] = array(); $config['aliases'] = array();
$sections[] = 'aliases'; $sections[] = 'aliases';
} }
if ($hasync['synchronizedhcpd'] != "" and is_array($config['dhcpd'])) if (isset($hasync['synchronizedhcpd']) && is_array($config['dhcpd']))
$sections[] = 'dhcpd'; $sections[] = 'dhcpd';
if ($hasync['synchronizewol'] != "") { if (isset($hasync['synchronizewol'])) {
if (!is_array($config['wol'])) if (!is_array($config['wol']))
$config['wol'] = array(); $config['wol'] = array();
$sections[] = 'wol'; $sections[] = 'wol';
} }
if ($hasync['synchronizestaticroutes'] != "") { if (isset($hasync['synchronizestaticroutes'])) {
if (!is_array($config['staticroutes'])) if (!is_array($config['staticroutes']))
$config['staticroutes'] = array(); $config['staticroutes'] = array();
if (!is_array($config['staticroutes']['route'])) if (!isset($config['staticroutes']['route']) || !is_array($config['staticroutes']['route']))
$config['staticroutes']['route'] = array(); $config['staticroutes']['route'] = array();
$sections[] = 'staticroutes'; $sections[] = 'staticroutes';
if (!is_array($config['gateways'])) if (!is_array($config['gateways']))
$config['gateways'] = array(); $config['gateways'] = array();
$sections[] = 'gateways'; $sections[] = 'gateways';
} }
if ($hasync['synchronizevirtualip'] != "") { if (isset($hasync['synchronizevirtualip'])) {
if (!is_array($config['virtualip'])) if (!isset($config['virtualip']) || !is_array($config['virtualip']))
$config['virtualip'] = array(); $config['virtualip'] = array();
$sections[] = 'virtualip'; $sections[] = 'virtualip';
} }
if ($hasync['synchronizelb'] != "") { if (isset($hasync['synchronizelb'])) {
if (!is_array($config['load_balancer'])) if (!is_array($config['load_balancer']))
$config['load_balancer'] = array(); $config['load_balancer'] = array();
$sections[] = 'load_balancer'; $sections[] = 'load_balancer';
} }
if ($hasync['synchronizeipsec'] != "") { if (isset($hasync['synchronizeipsec'])) {
if (!is_array($config['ipsec'])) if (!is_array($config['ipsec']))
$config['ipsec'] = array(); $config['ipsec'] = array();
$sections[] = 'ipsec'; $sections[] = 'ipsec';
} }
if ($hasync['synchronizeopenvpn'] != "") { if (isset($hasync['synchronizeopenvpn'])) {
if (!is_array($config['openvpn'])) if (!isset($config['openvpn']) || !is_array($config['openvpn']))
$config['openvpn'] = array(); $config['openvpn'] = array();
$sections[] = 'openvpn'; $sections[] = 'openvpn';
} }
if ($hasync['synchronizecerts'] != "" || $hasync['synchronizeopenvpn'] != "") { if (isset($hasync['synchronizecerts']) || isset($hasync['synchronizeopenvpn'])) {
if (!is_array($config['cert'])) if (!is_array($config['cert']))
$config['cert'] = array(); $config['cert'] = array();
$sections[] = 'cert'; $sections[] = 'cert';
...@@ -334,27 +335,27 @@ if (is_array($config['hasync'])) { ...@@ -334,27 +335,27 @@ if (is_array($config['hasync'])) {
$config['ca'] = array(); $config['ca'] = array();
$sections[] = 'ca'; $sections[] = 'ca';
if (!is_array($config['crl'])) if (!isset($config['crl']) || !is_array($config['crl']))
$config['crl'] = array(); $config['crl'] = array();
$sections[] = 'crl'; $sections[] = 'crl';
} }
if ($hasync['synchronizeusers'] != "") { if (isset($hasync['synchronizeusers'])) {
$sections[] = 'user'; $sections[] = 'user';
$sections[] = 'group'; $sections[] = 'group';
} }
if ($hasync['synchronizeauthservers'] != "") { if (isset($hasync['synchronizeauthservers'])) {
$sections[] = 'authserver'; $sections[] = 'authserver';
} }
if ($hasync['synchronizednsforwarder'] != "" and is_array($config['dnsmasq'])) if (isset($hasync['synchronizednsforwarder']) && is_array($config['dnsmasq']))
$sections[] = 'dnsmasq'; $sections[] = 'dnsmasq';
if ($hasync['synchronizeschedules'] != "" || $hasync['synchronizerules'] != "") { if (isset($hasync['synchronizeschedules']) || isset($hasync['synchronizerules'])) {
if (!is_array($config['schedules'])) if (!isset($config['schedules']) || !is_array($config['schedules']))
$config['schedules'] = array(); $config['schedules'] = array();
$sections[] = 'schedules'; $sections[] = 'schedules';
} }
if ($hasync['synchronizecaptiveportal'] != "" and is_array($config['captiveportal'])) if (isset($hasync['synchronizecaptiveportal']) && isset($config['captiveportal']) && is_array($config['captiveportal']))
$sections[] = 'captiveportal'; $sections[] = 'captiveportal';
if ($hasync['synchronizecaptiveportal'] != "" and is_array($config['vouchers'])) if (isset($hasync['synchronizecaptiveportal']) && isset($config['vouchers']) && is_array($config['vouchers']))
$sections[] = 'vouchers'; $sections[] = 'vouchers';
if (count($sections) <= 0) { if (count($sections) <= 0) {
......
...@@ -180,7 +180,7 @@ $pgtitle_output = true; ...@@ -180,7 +180,7 @@ $pgtitle_output = true;
<?php <?php
if (isset($shortcut_section) && !$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { if (isset($shortcut_section) && !empty($shortcuts[$shortcut_section]['service'])) {
$ssvc = array(); $ssvc = array();
switch ($shortcut_section) { switch ($shortcut_section) {
case "openvpn": case "openvpn":
......
...@@ -31,7 +31,7 @@ require_once("guiconfig.inc"); ...@@ -31,7 +31,7 @@ require_once("guiconfig.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php'); $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php');
if (!is_array($config['hasync'])) { if (!isset($config['hasync']) || !is_array($config['hasync'])) {
$config['hasync'] = array(); $config['hasync'] = array();
} }
...@@ -52,14 +52,17 @@ $checkbox_names = array('pfsyncenabled', ...@@ -52,14 +52,17 @@ $checkbox_names = array('pfsyncenabled',
'synchronizestaticroutes', 'synchronizestaticroutes',
'synchronizelb', 'synchronizelb',
'synchronizevirtualip', 'synchronizevirtualip',
'synchronizetrafficshaper',
'synchronizednsforwarder', 'synchronizednsforwarder',
'synchronizecaptiveportal'); 'synchronizecaptiveportal');
if ($_POST) { if ($_POST) {
$pconfig = $_POST; $pconfig = $_POST;
foreach ($checkbox_names as $name) { foreach ($checkbox_names as $name) {
$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false; if (isset($pconfig[$name])) {
$a_hasync[$name] = $pconfig[$name];
} else {
$a_hasync[$name] = false;
}
} }
$a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip']; $a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip'];
$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface']; $a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
...@@ -73,13 +76,19 @@ if ($_POST) { ...@@ -73,13 +76,19 @@ if ($_POST) {
} }
foreach ($checkbox_names as $name) { foreach ($checkbox_names as $name) {
$pconfig[$name] = $a_hasync[$name]; if (isset($a_hasync[$name])) {
$pconfig[$name] = $a_hasync[$name];
} else {
$pconfig[$name] = null;
}
}
foreach (array('pfsyncpeerip','pfsyncinterface','synchronizetoip','username','password') as $tag) {
if (isset($a_hasync[$tag])) {
$pconfig[$tag] = $a_hasync[$tag];
} else {
$pconfig[$tag] = null;
}
} }
$pconfig['pfsyncpeerip'] = $a_hasync['pfsyncpeerip'];
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
$pconfig['username'] = $a_hasync['username'];
$pconfig['password'] = $a_hasync['password'];
$ifaces = get_configured_interface_with_descr(); $ifaces = get_configured_interface_with_descr();
$ifaces["lo0"] = "loopback"; $ifaces["lo0"] = "loopback";
...@@ -331,24 +340,6 @@ include("head.inc"); ...@@ -331,24 +340,6 @@ include("head.inc");
Automatically sync the CARP Virtual IPs to the other HA host when changes are made. Automatically sync the CARP Virtual IPs to the other HA host when changes are made.
</td> </td>
</tr> </tr>
<tr valign="top">
<td width="22%" class="vncell">Synchronize traffic shaper(queues)</td>
<td class="vtable">
<input id='synchronizetrafficshaper' type='checkbox' name='synchronizetrafficshaper' value='on' <?php if ($pconfig['synchronizetrafficshaper'] === "on") {
echo "checked='checked'";
} ?> />
Automatically sync the traffic shaper configuration for queues to the other HA host when changes are made.
</td>
</tr>
<tr valign="top">
<td width="22%" class="vncell">Synchronize traffic shaper(limiter)</td>
<td class="vtable">
<input id='synchronizetrafficshaperlimiter' type='checkbox' name='synchronizetrafficshaperlimiter' value='on' <?php if ($pconfig['synchronizetrafficshaperlimiter'] === "on") {
echo "checked='checked'";
} ?> />
Automatically sync the traffic shaper configuration for limiters to the other HA host when changes are made.
</td>
</tr>
<tr valign="top"> <tr valign="top">
<td width="22%" class="vncell">Synchronize DNS Forwarder</td> <td width="22%" class="vncell">Synchronize DNS Forwarder</td>
<td class="vtable"> <td class="vtable">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment