* All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ require_once("guiconfig.inc"); require_once("interfaces.inc"); $a_hasync = &config_read_array('hasync'); $checkbox_names = array( 'pfsyncenabled', 'disablepreempt', 'disconnectppps', 'synchronizealiases', 'synchronizeauthservers', 'synchronizecerts', 'synchronizedhcpd', 'synchronizenat', 'synchronizerules', 'synchronizeschedules', 'synchronizestaticroutes', 'synchronizeusers', 'synchronizevirtualip', 'synchronizewidgets', ); $syncplugins = plugins_xmlrpc_sync(); foreach (array_keys($syncplugins) as $key) { $checkbox_names[] = 'synchronize'.$key; } if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig = array(); foreach ($checkbox_names as $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; } } } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { $input_errors = array(); $pconfig = $_POST; foreach ($checkbox_names as $name) { if (isset($pconfig[$name])) { $a_hasync[$name] = $pconfig[$name]; } else { $a_hasync[$name] = false; } } if (!empty($pconfig['pfsyncpeerip']) && !is_ipaddrv4($pconfig['pfsyncpeerip'])) { $input_errors[] = gettext('The synchronize peer IP must be an IPv4 address or left empty.'); } if (!count($input_errors)) { $a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface']; $a_hasync['synchronizetoip'] = $pconfig['synchronizetoip']; $a_hasync['username'] = $pconfig['username']; $a_hasync['password'] = $pconfig['password']; if (!empty($pconfig['pfsyncpeerip'])) { $a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip']; } elseif (isset($a_hasync['pfsyncpeerip'])) { unset($a_hasync['pfsyncpeerip']); } write_config('Updated High Availability configuration'); interfaces_carp_setup(); header(url_safe('Location: /system_hasync.php')); exit; } } legacy_html_escape_form_data($pconfig); include("head.inc"); ?>
/>
/>
/>
$synccnf):?>
/>