Commit da27fe7c authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor interfaces_ppps_edit.php, work in progress

parent 53607f42
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2010 Gabriel B. <gnoahb@gmail.com>. Copyright (C) 2010 Gabriel B. <gnoahb@gmail.com>.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("services.inc"); require_once("services.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_ppps.php');
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
define("CRON_DAILY_PATTERN", "0 0 * * *");
define("CRON_HOURLY_PATTERN", "0 * * * *");
if (!isset($config['ppps'])) { if (!isset($config['ppps'])) {
$config['ppps'] = array(); $config['ppps'] = array();
} }
if (!isset($config['ppps']['ppp'])) { if (!isset($config['ppps']['ppp'])) {
$config['ppps']['ppp'] = array(); $config['ppps']['ppp'] = array();
} }
$a_ppps = &$config['ppps']['ppp']; $a_ppps = &$config['ppps']['ppp'];
$iflist = get_configured_interface_with_descr();
$portlist = get_interface_list();
$portlist = array_merge($portlist, $iflist);
if (isset($config['vlans']['vlan'])) { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
foreach ($config['vlans']['vlan'] as $vlan) { $pconfig = array();
$portlist[$vlan['vlanif']] = $vlan; if (isset($_GET['id']) && !empty($a_ppps[$_GET['id']])) {
} $id = $_GET['id'];
}
$copy_fields = array('ptpid', 'type', 'username', 'idletimeout', 'uptime', 'descr', 'simpin', 'pin-wait',
'apn', 'apnum', 'phone', 'connect-timeout', 'provider', 'pppoe-reset-type');
foreach ($copy_fields as $fieldname) {
if (isset($a_ppps[$id][$fieldname])) {
$pconfig[$fieldname] = $a_ppps[$id][$fieldname];
} else {
$pconfig[$fieldname] = null;
}
}
$explode_fields = array('mtu', 'mru', 'mrru', 'bandwidth', 'localip', 'gateway', 'localip', 'subnet', 'ports');
foreach ($explode_fields as $fieldname) {
if (isset($a_ppps[$id][$fieldname])) {
$pconfig[$fieldname] = explode(",", $a_ppps[$id][$fieldname]);
} else {
$pconfig[$fieldname] = array();
}
}
$bool_fields = array('ondemand', 'shortseq', 'acfcomp', 'protocomp', 'vjcomp', 'tcpmssfix');
foreach ($bool_fields as $fieldname) {
$pconfig[$fieldname] = isset($a_ppps[$id][$fieldname]);
}
$pconfig['password'] = isset($a_ppps[$id]['password']) ? base64_decode($a_ppps[$id]['password']) : null;
$pconfig['initstr'] = isset($a_ppps[$id]['initstr']) ? base64_decode($a_ppps[$id]['initstr']) : null;
$pconfig['null_service'] = (isset($a_ppps[$id]['provider']) && empty($a_ppps[$id]['provider']));
if (!empty($a_ppps[$id]['pppoe-reset-type'])) {
$itemhash = getMPDCRONSettings($a_ppps[$id]['if']);
if (!empty($itemhash)) {
$cronitem = $itemhash['ITEM'];
$pconfig['pppoe_resetminute'] = $cronitem['minute'];
$pconfig['pppoe_resethour'] = $cronitem['hour'];
$pconfig['pppoe_resetmday'] = $cronitem['mday'];
$pconfig['pppoe_resetmonth'] = $cronitem['month'];
$pconfig['pppoe_resetwday'] = $cronitem['wday'];
}
}
if (empty($pconfig['ptpid'])) {
$pconfig['ptpid'] = interfaces_ptpid_next();
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['id']) && !empty($a_ppps[$_POST['id']])) {
$id = $_POST['id'];
}
$input_errors = array();
$pconfig = $_POST;
/* input validation */
switch($pconfig['type']) {
case "ppp":
$reqdfields = explode(" ", "ports phone");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Phone Number"));
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "pppoe":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "ports username password ondemand idletimeout");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Dial on demand"),gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "ports username password");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"));
}
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "l2tp":
case "pptp":
if ($pconfig['ondemand']) {
$reqdfields = explode(" ", "ports username password localip subnet gateway ondemand idletimeout");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "ports username password localip subnet gateway");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"));
}
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
break;
default:
$input_errors[] = gettext("Please choose a Link Type.");
break;
}
if ($pconfig['type'] == "ppp" && count($pconfig['ports']) > 1) {
$input_errors[] = gettext("Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface.");
}
if (!empty($pconfig['provider']) && !is_domain($pconfig['provider'])) {
$input_errors[] = gettext("The Service name contains invalid characters.");
}
if (!empty($pconfig['provider']) && !empty($pconfig['null_service'])) {
$input_errors[] = gettext("Do not specify both a Service name and a NULL Service name.");
}
if (($pconfig['idletimeout'] != "") && !is_numericint($pconfig['idletimeout'])) {
$input_errors[] = gettext("The idle timeout value must be an integer.");
}
if (!empty($pconfig['pppoe-reset-type'])) {
if (!empty($pconfig['pppoe_resethour']) && (!is_numericint($pconfig['pppoe_resethour']) || $pconfig['pppoe_resethour'] < 0 || $pconfig['pppoe_resethour'] > 23)) {
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
}
if (!empty($pconfig['pppoe_resetminute']) && (!is_numericint($pconfig['pppoe_resetminute']) || $pconfig['pppoe_resetminute'] < 0 || $pconfig['pppoe_resetminute'] > 59)) {
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
}
if (!empty($pconfig['pppoe_resetdate']) && !is_numeric(str_replace("/", "", $pconfig['pppoe_resetdate']))) {
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
}
}
foreach($pconfig['ports'] as $iface_idx => $iface){
if (!empty($pconfig['localip'][$iface_idx]) && !is_ipaddr($pconfig['localip'][$iface_idx])) {
$input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface);
}
if (!empty($pconfig['gateway'][$iface_idx]) && !is_ipaddr($pconfig['gateway'][$iface_idx]) && !is_hostname($pconfig['gateway'][$iface_idx])) {
$input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface);
}
if (!empty($pconfig['bandwidth'][$iface_idx]) && !is_numericint($pconfig['bandwidth'][$iface_idx])) {
$input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface);
}
if (!empty($pconfig['mtu'][$iface_idx]) && ($pconfig['mtu'][$iface_idx] < 576)) {
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface);
}
if (!empty($pconfig['mru'][$iface_idx]) && ($pconfig['mru'][$iface_idx] < 576)) {
$input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface);
}
}
if (count($input_errors) == 0) {
$ppp = array();
$ppp['ptpid'] = $pconfig['ptpid'];
$ppp['type'] = $pconfig['type'];
$ppp['if'] = $ppp['type'].$ppp['ptpid'];
$ppp['ports'] = implode(',',$pconfig['ports']);
$ppp['username'] = $pconfig['username'];
$ppp['password'] = base64_encode($pconfig['password']);
$ppp['ondemand'] = !empty($pconfig['ondemand']);
if (!empty($pconfig['idletimeout'])) {
$ppp['idletimeout'] = $pconfig['idletimeout'];
}
$ppp['uptime'] = !empty($pconfig['uptime']);
if (!empty($pconfig['descr'])) {
$ppp['descr'] = $pconfig['descr'];
}
// Loop through fields associated with a individual link/port and make an array of the data
$port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
$port_data = array();
foreach($pconfig['ports'] as $iface_idx => $iface){
$port_data[$field_label] = array();
foreach($port_fields as $field_label){
if (isset($pconfig[$field_label][$iface_idx])) {
$port_data[$field_label][] = $pconfig[$field_label][$iface_idx];
}
}
}
switch($pconfig['type']) {
case "ppp":
if (!empty($pconfig['initstr'])) {
$ppp['initstr'] = base64_encode($pconfig['initstr']);
}
if (!empty($pconfig['simpin'])) {
$ppp['simpin'] = $pconfig['simpin'];
$ppp['pin-wait'] = $pconfig['pin-wait'];
}
if (!empty($pconfig['apn'])){
$ppp['apn'] = $pconfig['apn'];
$ppp['apnum'] = $pconfig['apnum'];
}
$ppp['phone'] = $pconfig['phone'];
$ppp['localip'] = implode(',',$port_data['localip']);
$ppp['gateway'] = implode(',',$port_data['gateway']);
if (!empty($pconfig['connect-timeout'])) {
$ppp['connect-timeout'] = $pconfig['connect-timeout'];
}
break;
case "pppoe":
if (!empty($pconfig['provider'])) {
$ppp['provider'] = $pconfig['provider'];
} else {
$ppp['provider'] = !empty($pconfig['null_service']);
}
if (!empty($pconfig['pppoe-reset-type'])) {
$ppp['pppoe-reset-type'] = $pconfig['pppoe-reset-type'];
}
break;
case "pptp":
case "l2tp":
$ppp['localip'] = implode(',',$port_data['localip']);
$ppp['subnet'] = implode(',',$port_data['subnet']);
$ppp['gateway'] = implode(',',$port_data['gateway']);
break;
default:
break;
}
$ppp['shortseq'] = !empty($pconfig['shortseq']);
$ppp['acfcomp'] = !empty($pconfig['acfcomp']);
$ppp['protocomp'] = !empty($pconfig['protocomp']);
$ppp['vjcomp'] = !empty($pconfig['vjcomp']);
$ppp['tcpmssfix'] = !empty($pconfig['tcpmssfix']);
$ppp['bandwidth'] = implode(',', $port_data['bandwidth']);
$ppp['mtu'] = implode(',', $port_data['mtu']);
$ppp['mru'] = implode(',', $port_data['mru']);
$ppp['mrru'] = implode(',', $port_data['mrru']);
// XXX this was already in here, but is probably not the correct place to create this
if (!is_dir('/var/spool/lock')) {
mwexec('/bin/mkdir -p /var/spool/lock');
}
/* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we
must be able to clear the config data in the <cron> section of config.xml if it exists
*/
// yak... room for improvement here.... (see interfaces.php as well)
handle_pppoe_reset($pconfig);
if (isset($id)) {
$a_ppps[$id] = $ppp;
} else {
$a_ppps[] = $ppp;
}
write_config();
configure_cron();
$iflist = get_configured_interface_with_descr();
foreach ($iflist as $pppif => $ifdescr) {
if ($config['interfaces'][$pppif]['if'] == $ppp['if'])
interface_ppps_configure($pppif);
}
header("Location: interfaces_ppps.php");
exit;
}
} }
if (is_numericint($_GET['id'])) legacy_html_escape_form_data($pconfig);
$id = $_GET['id'];
if (isset($_POST['id']) && is_numericint($_POST['id']))
$id = $_POST['id'];
if (isset($id) && $a_ppps[$id]) {
$pconfig['ptpid'] = $a_ppps[$id]['ptpid'];
$pconfig['type'] = $a_ppps[$id]['type'];
//$pconfig['if'] = $a_ppps[$id]['if'];
$pconfig['interfaces'] = $a_ppps[$id]['ports'];
$pconfig['username'] = $a_ppps[$id]['username'];
$pconfig['password'] = base64_decode($a_ppps[$id]['password']);
if (isset($a_ppps[$id]['ondemand']))
$pconfig['ondemand'] = true;
$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
$pconfig['uptime'] = $a_ppps[$id]['uptime'];
$pconfig['descr'] = $a_ppps[$id]['descr'];
$pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
$pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
$pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
$pconfig['mrru'] = explode(",",$a_ppps[$id]['mrru']);
if (isset($a_ppps[$id]['shortseq']))
$pconfig['shortseq'] = true;
if (isset($a_ppps[$id]['acfcomp']))
$pconfig['acfcomp'] = true;
if (isset($a_ppps[$id]['protocomp']))
$pconfig['protocomp'] = true;
if (isset($a_ppps[$id]['vjcomp']))
$pconfig['vjcomp'] = true;
if (isset($a_ppps[$id]['tcpmssfix']))
$pconfig['tcpmssfix'] = true;
switch($a_ppps[$id]['type']) {
case "ppp":
$pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']);
$pconfig['simpin'] = $a_ppps[$id]['simpin'];
$pconfig['pin-wait'] = $a_ppps[$id]['pin-wait'];
$pconfig['apn'] = $a_ppps[$id]['apn'];
$pconfig['apnum'] = $a_ppps[$id]['apnum'];
$pconfig['phone'] = $a_ppps[$id]['phone'];
$pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout'];
$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
break;
case "l2tp":
case "pptp":
$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
$pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']);
$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
case "pppoe":
$pconfig['provider'] = $a_ppps[$id]['provider'];
if (isset($a_ppps[$id]['provider']) and empty($a_ppps[$id]['provider']))
$pconfig['null_service'] = true;
/* ================================================ */
/* = force a connection reset at a specific time? = */
/* ================================================ */
if (isset($a_ppps[$id]['pppoe-reset-type'])) {
$pconfig['pppoe-reset-type'] = $a_ppps[$id]['pppoe-reset-type'];
$itemhash = getMPDCRONSettings($a_ppps[$id]['if']);
$cronitem = $itemhash['ITEM'];
if (isset($cronitem)) {
$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
} else {
$resetTime = NULL;
}
if ($a_ppps[$id]['pppoe-reset-type'] == "custom") {
$resetTime_a = explode(" ", $resetTime);
$pconfig['pppoe_pr_custom'] = true;
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
$pconfig['pppoe_resethour'] = $resetTime_a[1];
/* just initialize $pconfig['pppoe_resetdate'] if the
* coresponding item contains appropriate numeric values.
*/
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*")
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
} else if ($a_ppps[$id]['pppoe-reset-type'] == "preset") {
$pconfig['pppoe_pr_preset'] = true;
switch ($resetTime) {
case CRON_MONTHLY_PATTERN:
$pconfig['pppoe_monthly'] = true;
break;
case CRON_WEEKLY_PATTERN:
$pconfig['pppoe_weekly'] = true;
break;
case CRON_DAILY_PATTERN:
$pconfig['pppoe_daily'] = true;
break;
case CRON_HOURLY_PATTERN:
$pconfig['pppoe_hourly'] = true;
break;
}
}
}
break;
}
} else {
$pconfig['ptpid'] = interfaces_ptpid_next();
}
if ($_POST) {
unset($input_errors);
/* okay first of all, cause we are just hiding the PPPoE HTML
* fields releated to PPPoE resets, we are going to unset $_POST
* vars, if the reset feature should not be used. Otherwise the
* data validation procedure below, may trigger a false error
* message.
*/
if (empty($_POST['pppoe-reset-type'])) {
unset($_POST['pppoe_resethour']);
unset($_POST['pppoe_resetminute']);
unset($_POST['pppoe_resetdate']);
unset($_POST['pppoe_pr_preset_val']);
}
if (!isset($_POST['interfaces'])) {
$_POST['interfaces'] = array();
}
$pconfig = $_POST;
/* input validation */
switch($_POST['type']) {
case "ppp":
$reqdfields = explode(" ", "interfaces phone");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Phone Number"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "pppoe":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Dial on demand"),gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "interfaces username password");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "l2tp":
case "pptp":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
default:
$input_errors[] = gettext("Please choose a Link Type.");
break;
}
if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1)
$input_errors[] = gettext("Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface.");
if ($_POST['provider'] && !is_domain($_POST['provider']))
$input_errors[] = gettext("The Service name contains invalid characters.");
if ($_POST['provider'] && $_POST['null_service'])
$input_errors[] = gettext("Do not specify both a Service name and a NULL Service name.");
if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout']))
$input_errors[] = gettext("The idle timeout value must be an integer.");
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))){
$date_nums = explode("/",$_POST['pppoe_resetdate']);
if ($date_nums[0] < 1 || $date_nums[0] > 12)
$input_errors[] = gettext("A valid PPPoE reset month must be specified (1-12) in the Custom PPPoE Periodic reset fields.");
if ($date_nums[1] < 1 || $date_nums[1] > 31)
$input_errors[] = gettext("A valid PPPoE reset day of month must be specified (1-31) in the Custom PPPoE Periodic reset fields. No checks are done on valid # of days per month");
if ($date_nums[2] < date("Y"))
$input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!");
}
foreach($_POST['interfaces'] as $iface){
if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface]))
$input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface);
if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface]))
$input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface);
if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface]))
$input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface);
if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576))
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface);
if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576))
$input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface);
}
/*
foreach ($a_ppps as $ppp) {
if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
continue;
if ($ppp['serialport'] == $_POST['serialport']) {
$input_errors[] = gettext("Serial port is in use");
break;
}
}
*/
if (!$input_errors) {
$ppp = array();
$ppp['ptpid'] = $_POST['ptpid'];
$ppp['type'] = $_POST['type'];
$ppp['if'] = $ppp['type'].$ppp['ptpid'];
$ppp['ports'] = implode(',',$_POST['interfaces']);
$ppp['username'] = $_POST['username'];
$ppp['password'] = base64_encode($_POST['password']);
$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
if (!empty($_POST['idletimeout']))
$ppp['idletimeout'] = $_POST['idletimeout'];
else
unset($ppp['idletimeout']);
$ppp['uptime'] = $_POST['uptime'] ? true : false;
if (!empty($_POST['descr']))
$ppp['descr'] = $_POST['descr'];
else
unset($ppp['descr']);
// Loop through fields associated with a individual link/port and make an array of the data
$port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
foreach($_POST['interfaces'] as $iface){
foreach($port_fields as $field_label){
if (isset($_POST[$field_label][$iface]))
$port_data[$field_label][] = $_POST[$field_label][$iface];
}
}
switch($_POST['type']) {
case "ppp":
if (!empty($_POST['initstr']))
$ppp['initstr'] = base64_encode($_POST['initstr']);
else
unset($ppp['initstr']);
if (!empty($_POST['simpin'])) {
$ppp['simpin'] = $_POST['simpin'];
$ppp['pin-wait'] = $_POST['pin-wait'];
} else {
unset($ppp['simpin']);
unset($ppp['pin-wait']);
}
if (!empty($_POST['apn'])){
$ppp['apn'] = $_POST['apn'];
$ppp['apnum'] = $_POST['apnum'];
} else {
unset($ppp['apn']);
unset($ppp['apnum']);
}
$ppp['phone'] = $_POST['phone'];
$ppp['localip'] = implode(',',$port_data['localip']);
$ppp['gateway'] = implode(',',$port_data['gateway']);
if (!empty($_POST['connect-timeout']))
$ppp['connect-timeout'] = $_POST['connect-timeout'];
else
unset($ppp['connect-timeout']);
break;
case "pppoe":
if (!empty($_POST['provider']))
$ppp['provider'] = $_POST['provider'];
else{
unset($ppp['provider']);
$ppp['provider'] = $_POST['null_service'] ? true : false;
}
if (!empty($_POST['pppoe-reset-type']))
$ppp['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
else
unset($ppp['pppoe-reset-type']);
break;
case "pptp":
case "l2tp":
$ppp['localip'] = implode(',',$port_data['localip']);
$ppp['subnet'] = implode(',',$port_data['subnet']);
$ppp['gateway'] = implode(',',$port_data['gateway']);
break;
default:
break;
}
$ppp['shortseq'] = $_POST['shortseq'] ? true : false;
$ppp['acfcomp'] = $_POST['acfcomp'] ? true : false;
$ppp['protocomp'] = $_POST['protocomp'] ? true : false;
$ppp['vjcomp'] = $_POST['vjcomp'] ? true : false;
$ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false;
$ppp['bandwidth'] = implode(',', $port_data['bandwidth']);
if (is_array($port_data['mtu']))
$ppp['mtu'] = implode(',', $port_data['mtu']);
if (is_array($port_data['mru']))
$ppp['mru'] = implode(',', $port_data['mru']);
if (is_array($port_data['mrru']))
$ppp['mrru'] = implode(',', $port_data['mrru']);
/* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we
must be able to clear the config data in the <cron> section of config.xml if it exists
*/
handle_pppoe_reset($_POST);
if (isset($id) && $a_ppps[$id])
$a_ppps[$id] = $ppp;
else
$a_ppps[] = $ppp;
write_config();
configure_cron();
foreach ($iflist as $pppif => $ifdescr) {
if ($config['interfaces'][$pppif]['if'] == $ppp['if'])
interface_ppps_configure($pppif);
}
header("Location: interfaces_ppps.php");
exit;
}
} // end if($_POST)
$closehead = false; $closehead = false;
include("head.inc"); include("head.inc");
$types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "L2TP"/*, "tcp" => "TCP", "udp" => "UDP"*/ );
?> ?>
<body> <body>
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script> <script type="text/javascript">
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" /> $(document).ready(function() {
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script> // change type
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/> $("#type").change(function(){
<script type="text/javascript"> $('#ppp,#ppp_adv,#pppoe,#pppoe_adv,#ppp_provider,#phone_num,#apn_').hide();
//<![CDATA[ $('#ports > [data-type="serial"]').hide();
jQuery(document).ready(function() { updateType(<?php echo "'{$pconfig['type']}'";?>); }); $('#ports > [data-type="serial"]').prop('disabled', true);
//]]> $('#ports > [data-type="interface"]').hide();
</script> $('#ports > [data-type="interface"]').prop('disabled', true);
switch($("#type").val()) {
case "ppp":
$('#ppp,#ppp_adv,#ppp_provider,#phone_num,#apn_').show();
$('#ports > [data-type="serial"]').show();
$('#ports > [data-type="serial"]').prop('disabled', false);
$('#country').children().remove();
$('#provider_list').children().remove();
$('#providerplan').children().remove();
$.ajax("getserviceproviders.php",{
success: function(response) {
var responseTextArr = response.split("\n");
responseTextArr.sort();
$.each(responseTextArr, function(index, value) {
country = value.split(':');
$('#country').append(new Option(country[0], country[1]));
});
}
});
$('#trcountry').removeClass("hidden");
$("#interface_details").hide();
break;
case "pppoe":
$('#pppoe').show();
$('#pppoe_adv').show();
// fall through to show interface items
default:
$('#ports > [data-type="interface"]').show();
$('#ports > [data-type="interface"]').prop('disabled', false);
$("#interface_details").show();
break;
}
});
$("#type").change();
// change interfaces / ports selection
$("#ports").change(function(){
for (i=0; i <= $("#ports").children().length; ++i) {
if ($('#ports :selected').length > i) {
$(".intf_select_"+i).prop('disabled', false);
$(".intf_select_"+i).show();
} else {
$(".intf_select_"+i).prop('disabled', true);
$(".intf_select_"+i).hide();
}
}
// add item text
var i=0;
$('#ports :selected').each(function(){
$(".intf_select_txt_"+i).html('( '+ $(this).val() + ' )');
i++;
});
});
$("#ports").change();
// advanced options
$("#show_advanced").click(function(){
$(".act_show_advanced").show();
$("#show_advanced_opt").hide();
})
// ppp -> country change
$("#country").change(function(){
$('#provider_list').children().remove();
$('#providerplan').children().remove();
$.ajax("getserviceproviders.php",{
type: 'post',
data: {country : $('#country').val()},
success: function(response) {
var responseTextArr = response.split("\n");
responseTextArr.sort();
$.each(responseTextArr, function(index, value) {
$('#provider_list').append(new Option(value, value));
});
}
});
$('#trprovider').removeClass("hidden");
$('#trproviderplan').addClass("hidden");
});
$('#trprovider').change(function() {
$('#providerplan').children().remove();
$('#providerplan').append(new Option('', ''));
$.ajax('getserviceproviders.php', {
type: 'post',
data: {country : jQuery('#country').val(), provider : $('#provider_list').val()},
success: function(response) {
var responseTextArr = response.split("\n");
responseTextArr.sort();
jQuery.each(responseTextArr, function(index, value) {
if (value != '') {
providerplan = value.split(':');
$('#providerplan').append(new Option(
providerplan[0] + ' - ' + providerplan[1],
providerplan[1]
));
}
});
}
});
$('#trproviderplan').removeClass("hidden");
});
$("#trproviderplan").change(function() {
$.ajax("getserviceproviders.php", {
type: 'post',
data: {country : $('#country').val(), provider : $('#provider_list').val(), plan : $('#providerplan').val()},
success: function(data,textStatus,response) {
var xmldoc = response.responseXML;
var provider = xmldoc.getElementsByTagName('connection')[0];
$('#username').val('');
$('#password').val('');
if (provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
$('#phone').val('#777');
$('#apn').val('');
} else {
$('#phone').val('*99#');
$('#apn').val(provider.getElementsByTagName('apn')[0].firstChild.data);
}
if (provider.getElementsByTagName('username')[0].firstChild != null) {
$('#username').val(provider.getElementsByTagName('username')[0].firstChild.data);
}
if (provider.getElementsByTagName('password')[0].firstChild != null) {
$('#password').val(provider.getElementsByTagName('password')[0].firstChild.data);
}
}
});
});
});
</script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<section class="page-content-main">
<section class="page-content-main"> <div class="container-fluid">
<div class="container-fluid"> <div class="row">
<div class="row"> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <div class="content-box">
<div id="inputerrors"></div> <form action="interfaces_ppps_edit.php" method="post" name="iform" id="iform">
<div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<section class="col-xs-12"> <table class="table table-striped">
<thead>
<div class="content-box"> <tr>
<td width="22%"><strong><?=gettext("PPPs configuration");?></strong></td>
<header class="content-box-head container-fluid"> <td width="78%" align="right">
<h3><?=gettext("PPPs configuration");?></h3> <small><?=gettext("full help"); ?> </small>
</header> <i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
&nbsp;
<div class="content-box-main"> </td>
</tr>
<form action="interfaces_ppps_edit.php" method="post" name="iform" id="iform"> </thead>
<table class="table table-striped table-sort"> <tbody>
<tr> <tr>
<td valign="middle" class="vncell"><strong><?= gettext("Link Type"); ?></strong></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Link Type"); ?></td>
<td class="vtable"> <td>
<select name="type" onchange="updateType(this.value);" class="selectpicker" id="type"> <select name="type" class="selectpicker" id="type">
<?php <?php
foreach ($types as $key => $opt) { $types = array("ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "L2TP");
echo "<option onclick=\"updateType('{$key}');\""; foreach ($types as $key => $opt):?>
if ($key == $pconfig['type']) <option value="<?=$key;?>" <?=$key == $pconfig['type'] ? "selected=\"selected\"" : "";?>><?=$opt;?></option>
echo " selected=\"selected\""; <?php
echo " value=\"{$key}\" >" . htmlspecialchars($opt) . "</option>"; endforeach;?>
} </select>
?> </td>
</select> </tr>
</td> <tr>
</tr> <td><a id="help_for_ports" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Link interface(s)"); ?></td>
<tr name="interface" id="interface" > <td>
<td width="22%" valign="top" class="vncellreq"><?= gettext("Link interface(s)"); ?></td> <select style="vertical-align:top" name="ports[]" id="ports" multiple="multiple" class="form-control" size="4">
<td width="78%" class="vtable"> <?php
<select style="vertical-align:top" name="interfaces[]" multiple="multiple" class="form-control" size="4" onchange="show_hide_linkfields(this.options);"> $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
<option></option> foreach ($serialports as $port):?>
</select> <option data-type="serial" value="<?=$port;?>" <?=in_array($port, $pconfig['ports']) ? "selected=\"selected\"" : "";?> >
<?=$port;?>
<br /><span class="vexpl"><?= gettext("Select at least two interfaces for Multilink (MLPPP) connections."); ?></span> </option>
</td> <?php
</tr> endforeach;?>
<tr style="display:none" name="portlists" id="portlists"> <?php
<td id="serialports"><?php $portlist = get_interface_list();
$selected_ports = array(); $iflist = get_configured_interface_with_descr();
if (isset($pconfig['interfaces'])) { $portlist = array_merge($portlist, $iflist);
$selected_ports = explode(',',isset($pconfig['interfaces']));
} if (isset($config['vlans']['vlan'])) {
if (!is_dir('/var/spool/lock')) { foreach ($config['vlans']['vlan'] as $vlan) {
mwexec('/bin/mkdir -p /var/spool/lock'); $portlist[$vlan['vlanif']] = $vlan;
} }
$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); }
$serport_count = 0; foreach ($portlist as $intf_key => $intf_value):?>
foreach ($serialports as $port) { <option data-type="interface" value="<?=$intf_key;?>" <?=in_array($intf_key, $pconfig['ports']) ? "selected=\"selected\"" : "";?> >
$serport_count++; <?=$intf_key;?> <?=isset($intf_value['mac']) ? '('.$intf_value['mac'].')' : "";?>
echo $port.",".trim($port); </option>
if (in_array($port,$selected_ports)) <?php
echo ",1|"; endforeach;?>
else </select>
echo ",|"; <div class="hidden" for="help_for_ports">
} <?= gettext("Select at least two interfaces for Multilink (MLPPP) connections."); ?>
echo $serport_count; </div>
?></td> </td>
<td id="ports"><?php </tr>
$port_count = 0; <tr>
foreach ($portlist as $ifn => $ifinfo){ <td><a id="help_for_descr" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Description"); ?></td>
$port_count++; <td>
$string = ""; <input name="descr" type="text" value="<?=$pconfig['descr'];?>" />
if (is_array($ifinfo)) { <div class="hidden" for="help_for_descr">
$string .= $ifn; <?= gettext("You may enter a description here for your reference. Description will appear in the \"Interfaces Assign\" select lists."); ?>
if ($ifinfo['mac']) </div>
$string .= " ({$ifinfo['mac']})"; </td>
} else </tr>
$string .= $ifinfo; <tr id="ppp_provider">
$string .= ",{$ifn}"; <td width="22%"><a id="help_for_country" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Service Provider"); ?></td>
echo htmlspecialchars($string); <td width="78%">
if (in_array($ifn,$selected_ports)) <table class="table table-condensed">
echo ",1|"; <tr id="trcountry" class="hidden">
else <td><?=gettext("Country:"); ?></td>
echo ",|"; <td>
} <select name="country" id="country">
echo $port_count; <option></option>
if($serport_count > $port_count) </select>
$port_count=$serport_count; </td>
?></td> </tr>
<td style="display:none" name="port_count" id="port_count"><?=htmlspecialchars($port_count);?></td> <tr id="trprovider" class="hidden">
</tr> <td><?=gettext("Provider:"); ?> &nbsp;&nbsp;</td>
<tr> <td>
<td width="22%" valign="top" class="vncell"><?= gettext("Description"); ?></td> <select name="provider_list" id="provider_list">
<td width="78%" class="vtable"> <option></option>
<input name="descr" type="text" class="form-control unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" /> </select>
<br /> <span class="vexpl"><?= gettext("You may enter a description here for your reference. Description will appear in the \"Interfaces Assign\" select lists."); ?></span> </td>
</td> </tr>
</tr> <tr id="trproviderplan" class="hidden">
<tr style="display:none" name="select" id="select"><td style="display:none"></td></tr> <td><?=gettext("Plan:"); ?> &nbsp;&nbsp;</td>
<?php $k=0; ?> <td>
<tr style="display:none" name="ppp_provider" id="ppp_provider"> <select name="providerplan" id="providerplan">
<td width="22%" valign="top" class="vncell"><?= gettext("Service Provider"); ?></td> <option></option>
<td width="78%" class="vtable"> </select>
<table border="0" cellpadding="0" cellspacing="0" summary="service provider" class="table table-striped"> </td>
<tr id="trcountry" style="display:none"> </tr>
<td width="25%"><?= gettext("Country:"); ?> &nbsp;&nbsp;</td> </table>
<td> <div class="hidden" for="help_for_country">
<select class="form-control" name="country" id="country" onchange="providers_list()"> <?=gettext("Select to fill in data for your service provider."); ?>
<option></option> </div>
</select> </td>
</td> </tr>
</tr> <tr>
<tr id="trprovider" style="display:none"> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Username"); ?></td>
<td><?= gettext("Provider:"); ?> &nbsp;&nbsp;</td> <td>
<td> <input name="username" type="text" id="username" value="<?=$pconfig['username'];?>" />
<select class="form-control" name="provider" id="provider" onchange="providerplan_list()"> </td>
<option></option> </tr>
</select> <tr>
</td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Password"); ?></td>
</tr> <td>
<tr id="trproviderplan" style="display:none"> <input name="password" type="password" id="password" value="<?=$pconfig['password'];?>" />
<td><?= gettext("Plan:"); ?> &nbsp;&nbsp;</td> </td>
<td> </tr>
<select class="form-control" name="providerplan" id="providerplan" onchange="prefill_provider()"> <tr style="display:none" name="phone_num" id="phone_num">
<option></option> <td><a id="help_for_phone" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Phone Number"); ?></td>
</select> <td>
</td> <input name="phone" type="text" id="phone" value="<?=$pconfig['phone'];?>" />
</tr> <div class="hidden" for="help_for_phone">
</table> <?= gettext("Note: Typically *99# for GSM networks and #777 for CDMA networks"); ?>
<br /><span class="vexpl"><?= gettext("Select to fill in data for your service provider."); ?></span> </div>
</td> </td>
</tr> </tr>
<tr> <tr style="display:none" name="apn_" id="apn_">
<td width="22%" valign="top" class="vncell"><?= gettext("Username"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Access Point Name (APN)"); ?></td>
<td width="78%" class="vtable"> <td>
<input name="username" type="text" class="form-control user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>" /> <input name="apn" type="text" id="apn" value="<?=$pconfig['apn'];?>" />
</td> </td>
</tr> </tr>
<tr> <tr style="display:none" name="pppoe" id="pppoe">
<td width="22%" valign="top" class="vncell"><?= gettext("Password"); ?></td> <td><a id="help_for_provider" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Service name"); ?></td>
<td width="78%" class="vtable"> <td>
<input name="password" type="password" class="form-control pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>" /> <input name="provider" type="text" id="provider" value="<?=$pconfig['provider'];?>" />&nbsp;&nbsp;
</td> <input type="checkbox" value="on" id="null_service" name="null_service" <?=!empty($pconfig['null_service']) ? "checked=\"checked\"" : ""; ?> /> <?= gettext("Configure a NULL Service name"); ?>
</tr> <div class="hidden" for="help_for_provider">
<?= gettext("Hint: this field can usually be left empty. Service name will not be configured if this field is empty. Check the \"Configure NULL\" box to configure a blank Service name."); ?>
<tr style="display:none" name="phone_num" id="phone_num"> </div>
<td width="22%" valign="top" class="vncell"><?= gettext("Phone Number"); ?></td> </td>
<td width="78%" class="vtable"> </tr>
<input name="phone" type="text" class="form-control unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>" /> </tbody>
<br /><span class="vexpl"><?= gettext("Note: Typically *99# for GSM networks and #777 for CDMA networks"); ?></span> </table>
</td> <table class="table table-striped" id="interface_details" style="display:none">
</tr> <tbody>
<tr style="display:none" name="apn_" id="apn_"> <?php
<td width="22%" valign="top" class="vncell"><?= gettext("Access Point Name (APN)"); ?></td> for ($intf_idx=0; $intf_idx <= max(count($serialports), count($portlist)) ; ++$intf_idx):?>
<td width="78%" class="vtable"> <tr style="display:none" class="intf_select_<?=$intf_idx;?>">
<input name="apn" type="text" class="form-control unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>" /> <td width="22%"><a id="help_for_localip_<?=$intf_idx;?>" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Local IP");?> <span class="intf_select_txt_<?=$intf_idx;?>"> </span></td>
</td> <td width="78%">
</tr> <input name="localip[]" type="text" class="intf_select_<?=$intf_idx;?>" value="<?=isset($pconfig['localip'][$intf_idx]) ? $pconfig['localip'][$intf_idx] : "";?>" />
/
<tr style="display:none" name="ppp" id="ppp"> <select name="subnet[]" class="intf_select_<?=$intf_idx;?>">
<td colspan="2" style="padding:0px;"> <?php for ($i = 31; $i > 0; $i--): ?>
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="advanced" class="table table-striped"> <option value="<?=$i;?>" <?= isset($pconfig['subnet'][$intf_idx]) && $i == $pconfig['subnet'][$intf_idx] ? "selected=\"selected\"" : "";?>>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <?=$i;?>
<td width="22%" valign="top" class="vncell"><?= gettext("APN number (optional)"); ?></td> </option>
<td width="78%" class="vtable"> <?php endfor; ?>
<input name="apnum" type="text" class="form-control unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>" /> </select>
<br /><span class="vexpl"><?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?></span> <div class="hidden" for="help_for_localip_<?=$intf_idx;?>">
</td> <?= gettext("IP Address"); ?>
</tr> </div>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </td>
<td width="22%" valign="top" class="vncell"><?= gettext("SIM PIN"); ?></td> </tr>
<td width="78%" class="vtable"> <tr style="display:none" class="intf_select_<?=$intf_idx;?>">
<input name="simpin" type="text" class="form-control unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>" /> <td width="22%"><a id="help_for_gateway_<?=$intf_idx;?>" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Gateway");?> <span class="intf_select_txt_<?=$intf_idx;?>"> </span></td>
</td> <td width="78%">
</tr> <input name="gateway[]" type="text" class="intf_select_<?=$intf_idx;?>" value="<?=isset($pconfig['gateway'][$intf_idx]) ? $pconfig['gateway'][$intf_idx] : "";?>" />
<div class="hidden" for="help_for_gateway_<?=$intf_idx;?>">
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <?= gettext("IP Address OR Hostname"); ?>
<td width="22%" valign="top" class="vncell"><?= gettext("SIM PIN wait"); ?></td> </div>
<td width="78%" class="vtable"> </td>
<input name="pin-wait" type="text" class="form-control unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>" /> </tr>
<br /><span class="vexpl"><?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?></span> <?php
</td> endfor;?>
</tr> </tbody>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </table>
<td width="22%" valign="top" class="vncell"><?= gettext("Init String"); ?></td> </div>
<td width="78%" class="vtable"> </div>
<input type="text" size="40" class="form-control unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>" />
<br /><span class="vexpl"><?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\"" . <!-- Advanced (button, show options) -->
" string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?></span> <div class="tab-content content-box col-xs-12 __mb" id="show_advanced_opt">
</td> <div class="table-responsive">
</tr> <table class="table table-striped" >
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <tbody>
<td width="22%" valign="top" class="vncell"><?= gettext("Connection Timeout"); ?></td> <tr>
<td width="78%" class="vtable"> <td width="22%">&nbsp;</td>
<input name="connect-timeout" type="text" class="form-control unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>" /> <td width="78%">
<br /><span class="vexpl"><?= gettext("Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec."); ?></span> <input type="button" id="show_advanced" value="<?=gettext("Show advanced options"); ?>" class="btn btn-default btn-xs"/>
</td> </td>
</tr> </tr>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </tbody>
<td valign="top" class="vncell"><?= gettext("Uptime Logging"); ?></td> </table>
<td class="vtable"> </div>
<input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked=\"checked\""; ?> /> <?= gettext("Enable persistent logging of connection uptime."); ?> </div>
<br /> <span class="vexpl"><?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?></span> <div class="tab-content content-box col-xs-12 __mb" >
</td> <div class="table-responsive">
</tr> <!-- Advanced PPOE -->
</table> <table class="table table-striped" id="pppoe_adv" style="display:none">
</td> <thead>
</tr> <tr style="display:none" class="act_show_advanced">
<tr style="display:none" name="pppoe" id="pppoe"> <th colspan="2"><?= gettext("Advanced Options"); ?></th>
<td colspan="2" style="padding:0px;"> </tr>
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="service name" class="table table-striped"> </thead>
<tr> <tbody>
<td width="22%" valign="top" class="vncell"><?= gettext("Service name"); ?></td> <tr style="display:none" class="act_show_advanced">
<td width="78%" class="vtable"><input name="provider" type="text" class="form-control unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>" />&nbsp;&nbsp; <td width="22%"><a id="help_for_reset_type" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Periodic reset");?></td>
<input type="checkbox" value="on" id="null_service" name="null_service" <?php if (isset($pconfig['null_service'])) echo "checked=\"checked\""; ?> /> <?= gettext("Configure a NULL Service name"); ?> <td width="78%">
<br /> <span class="vexpl"><?= gettext("Hint: this field can usually be left empty. Service name will not be configured if this field is empty. Check the \"Configure NULL\" box to configure a blank Service name."); ?></span> <select style="vertical-align:top" id="reset_type" name="pppoe-reset-type" class="selectpicker" data-style="btn-default" onchange="show_reset_settings(this.value);">
</td> <option value=""><?=gettext("Disabled"); ?></option>
</tr> <option value="custom" <?=$pconfig['pppoe-reset-type'] == "custom" ? "selected=\"selected\"" : ""; ?>><?=gettext("Custom"); ?></option>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <option value="preset" <?=$pconfig['pppoe-reset-type'] == "preset" ? "selected=\"selected\"" : ""; ?>><?=gettext("Pre-Set"); ?></option>
<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td> </select>
<td width="78%" class="vtable"> <div class="hidden" for="help_for_reset_type">
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" summary="periodic reset" class="table table-striped"> <?=gettext("Select a reset timing type"); ?>
<tr> </div>
<td align="left" valign="top"> <div style="<?=$pconfig['pppoe-reset-type'] != "custom" ? "display: none;" :"";?>" id="pppoecustomwrap">
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;"> <hr/>
<select style="vertical-align:top" id="reset_type" name="pppoe-reset-type" class="selectpicker" onchange="show_reset_settings(this.value);"> <input type="text" name="pppoe_resethour" id="pppoe_resethour" value="<?=$pconfig['pppoe_resethour']; ?>" />
<option value = ""><?= gettext("Disabled"); ?></option> <?= gettext("hour (0-23)"); ?><br />
<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected=\"selected\""; ?>><?= gettext("Custom"); ?></option> <input type="text" name="pppoe_resetminute" id="pppoe_resetminute" value="<?=$pconfig['pppoe_resetminute']; ?>" />
<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected=\"selected\""; ?>><?= gettext("Pre-Set"); ?></option> <?= gettext("minute (0-59)"); ?><br />
</select> <?= gettext("Select a reset timing type"); ?> <?php
</p> if (!empty($pconfig['pppoe_resetmday']) && $pconfig['pppoe_resetmday'] <> "*" && $pconfig['pppoe_resetmonth'] <> "*") {
<?php if ($pconfig['pppoe_pr_custom']): ?> $pconfig['pppoe_resetdate'] = "{$pconfig['pppoe_resetmonth']}/{$pconfig['pppoe_resetmday']}/" . date("Y");
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap"> }
<?php else: ?> ?>
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap"> <input name="pppoe_resetdate" type="text" id="pppoe_resetdate" value="<?=$pconfig['pppoe_resetdate'];?>" />
<?php endif; ?> <?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
<input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
<?= gettext("hour (0-23)"); ?><br /> <div class="hidden" for="help_for_reset_type">
<input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" /> <span class="text-warning"><strong><?=gettext("Note:");?></strong></span><br/>
<?= gettext("minute (0-59)"); ?><br /> <?= gettext("If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field."); ?>
<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" /> </div>
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?> </div>
<br />&nbsp;<br /> <?php
<span class="red"><strong><?=gettext("Note:");?></strong></span> if ($pconfig['pppoe-reset-type'] == "preset") {
<?= gettext("If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field."); ?> $resetTime = "{$pconfig['pppoe_resetminute']} {$pconfig['pppoe_resethour']} {$pconfig['pppoe_resetmday']} {$pconfig['pppoe_resetmonth']} {$pconfig['pppoe_resetwday']}";
</p> switch ($resetTime) {
<?php if ($pconfig['pppoe_pr_preset']): ?> case "0 0 1 * *": // CRON_MONTHLY_PATTERN
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap"> $pconfig['pppoe_monthly'] = true;
<?php else: ?> break;
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap"> case "0 0 * * 0": // CRON_WEEKLY_PATTERN
<?php endif; ?> $pconfig['pppoe_weekly'] = true;
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> break;
<?= gettext("reset at each month ('0 0 1 * *')"); ?> case "0 0 * * *": // CRON_DAILY_PATTERN
<br /> $pconfig['pppoe_daily'] = true;
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> break;
<?= gettext("reset at each week ('0 0 * * 0')"); ?> case "0 * * * *": //CRON_HOURLY_PATTERN
<br /> $pconfig['pppoe_hourly'] = true;
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> break;
<?= gettext("reset at each day ('0 0 * * *')"); ?> }
<br /> }?>
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> <div style="<?=$pconfig['pppoe-reset-type'] != "preset" ? "display: none;" :"";?>" id="pppoepresetwrap">
<?= gettext("reset at each hour ('0 * * * *')"); ?> <input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?=!empty($pconfig['pppoe_monthly']) ? "checked=\"checked\"" : ""; ?> />
</p> <?=gettext("reset at each month ('0 0 1 * *')"); ?>
</td> <br />
</tr> <input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?=!empty($pconfig['pppoe_weekly']) ? "checked=\"checked\"" : ""; ?> />
</table> <?=gettext("reset at each week ('0 0 * * 0')"); ?>
</td> <br />
</tr> <input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?=!empty($pconfig['pppoe_daily']) ? "checked=\"checked\"" : ""; ?> />
</table> <?=gettext("reset at each day ('0 0 * * *')"); ?>
</td> <br />
</tr> <input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?=!empty($pconfig['pppoe_hourly']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("reset at each hour ('0 * * * *')"); ?>
<?php for($j=0; $j < $port_count; $j++) : ?> </div>
</td>
<tr style="display:none" id="gw_fields<?=$j;?>"> </tr>
<td width="22%" id="localiplabel<?=$j;?>" valign="top" class="vncell"><?= gettext("Local IP"); ?></td> </tbody>
<td width="78%" class="vtable"> </table>
<input name="localip[]" type="text" class="form-control unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>" /> <!-- Advanced PPP -->
/ <table class="table table-striped" id="ppp_adv" style="display:none">
<select name="subnet[]" class="form-control" id="subnet<?=$j;?>" disabled="disabled"> <thead>
<?php for ($i = 31; $i > 0; $i--): ?> <tr style="display:none" class="act_show_advanced">
<option value="<?=$i;?>"<?php if ($i == $pconfig['subnet'][$j]) echo " selected=\"selected\""; ?>><?=$i;?></option> <th colspan="2"><?= gettext("Advanced Options"); ?></th>
<?php endfor; ?> </tr>
</select> <?= gettext("IP Address"); ?> </thead>
<tbody>
</td> <tr style="display:none" class="act_show_advanced">
</tr> <td width="22%"><a id="help_for_apnum" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("APN number (optional)"); ?></td>
<tr style="display:none" id="ip_fields<?=$j;?>"> <td width="78%">
<td width="22%" id="gatewaylabel<?=$j;?>" valign="top" class="vncell"></td> <input name="apnum" type="text" id="apnum" value="<?=$pconfig['apnum'];?>" />
<td width="78%" class="vtable"> <div class="hidden" for="help_for_apnum">
<input name="gateway[]" type="text" class="form-control unknown" id="gateway<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['gateway'][$j]);?>" /><?= gettext("IP Address OR Hostname"); ?> <?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?>
</td> </div>
</tr><?php endfor; ?> </td>
</tr>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <tr style="display:none" class="act_show_advanced">
<td colspan="2" valign="top" height="16"></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("SIM PIN"); ?></td>
</tr> <td>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <input name="simpin" type="text" id="simpin" value="<?=$pconfig['simpin'];?>" />
<td colspan="2" valign="top" class="listtopic"><?= gettext("Advanced Options"); ?></td> </td>
</tr> </tr>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <tr style="display:none" class="act_show_advanced">
<td valign="top" class="vncell"><?= gettext("Dial On Demand"); ?></td> <td><a id="help_for_pin-wait" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("SIM PIN wait"); ?></td>
<td class="vtable"> <td>
<input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked=\"checked\""; ?> /> <?= gettext("Enable Dial-on-Demand mode"); ?> <input name="pin-wait" type="text" cid="pin-wait" value="<?=$pconfig['pin-wait'];?>" />
<br /> <span class="vexpl"><?= gettext("This option causes the interface to operate in dial-on-demand mode. Do NOT enable if you want your link to be always up. " . <div class="hidden" for="help_for_pin-wait">
"The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?> </span> <?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?>
</td> </div>
</tr> </td>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </tr>
<td valign="top" class="vncell"><?= gettext("Idle Timeout"); ?></td> <tr style="display:none" class="act_show_advanced">
<td class="vtable"> <td><a id="help_for_initstr" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Init String"); ?></td>
<input name="idletimeout" type="text" class="form-control unknown" id="idletimeout" size="12" value="<?=htmlspecialchars($pconfig['idletimeout']);?>" /> <?= gettext("(seconds) Default is 0, which disables the timeout feature."); ?> <td>
<br /> <span class="vexpl"><?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.");?> <input type="text" id="initstr" name="initstr" value="<?=$pconfig['initstr'];?>" />
<br /><?=gettext("When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed."); ?></span> <div class="hidden" for="help_for_initstr">
</td> <?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\"" .
</tr> " string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </div>
<td width="22%" valign="top" class="vncell"><?= gettext("Compression"); ?></td> </td>
<td width="78%" class="vtable"> </tr>
<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked=\"checked\""; ?> />&nbsp;<?= gettext("Disable vjcomp(compression) (auto-negotiated by default)."); ?> <tr style="display:none" class="act_show_advanced">
<br /> <span class="vexpl"><?=gettext("This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. " . <td><a id="help_for_connect-timeout" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Connection Timeout"); ?></td>
"You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time " . <td>
"stamping or SACK, which modify TCP options between sequential packets.");?></span> <input name="connect-timeout" type="text" id="connect-timeout" value="<?=$pconfig['connect-timeout'];?>" />
</td> <div class="hidden" for="help_for_connect-timeout">
</tr> <?= gettext("Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec."); ?>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </div>
<td width="22%" valign="top" class="vncell"><?= gettext("TCPmssFix"); ?></td> </td>
<td width="78%" class="vtable"> </tr>
<input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked=\"checked\""; ?> />&nbsp;<?= gettext("Disable tcpmssfix (enabled by default)."); ?> <tr style="display:none" class="act_show_advanced">
<br /> <span class="vexpl"><?=gettext("This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount ". <td><a id="help_for_uptime" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Uptime Logging"); ?></td>
"allowed by the interface MTU. This is necessary in many setups to avoid problems caused by routers that drop ICMP Datagram Too Big messages. Without these messages, ". <td>
"the originating machine sends data, it passes the rogue router then hits a machine that has an MTU that is not big enough for the data. Because the IP Don't Fragment option is set, ". <input type="checkbox" value="on" id="uptime" name="uptime" <?=!empty($pconfig['uptime']) ? "checked=\"checked\"" : ""; ?> />
"this machine sends an ICMP Datagram Too Big message back to the originator and drops the packet. The rogue router drops the ICMP message and the originator never ". <?= gettext("Enable persistent logging of connection uptime."); ?>
"gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.");?></span> <div class="hidden" for="help_for_uptime">
</td> <?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?>
</tr> </div>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </td>
<td width="22%" valign="top" class="vncell"><?=gettext("ShortSeq");?></td> </tr>
<td width="78%" class="vtable"> </tbody>
<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked=\"checked\""; ?> />&nbsp;<?= gettext("Disable shortseq (auto-negotiated by default)."); ?> </table>
<br /> <span class="vexpl"><?= gettext("This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame. " . <!-- Advanced (all) -->
"It is not necessary to disable this for connections that are not multi-link."); ?></span> <table class="table table-striped" >
</td> <tbody>
</tr> <tr style="display:none" class="act_show_advanced">
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%"><a id="help_for_ondemand" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Dial On Demand"); ?></td>
<td width="22%" valign="top" class="vncell"><?=gettext("ACFComp"); ?></td> <td width="78%">
<td width="78%" class="vtable"> <input type="checkbox" value="on" id="ondemand" name="ondemand" <?=!empty($pconfig['ondemand']) ? "checked=\"checked\"" : ""; ?> />
<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked=\"checked\""; ?> />&nbsp;<?= gettext("Disable acfcomp (compression) (auto-negotiated by default)."); ?> <?= gettext("Enable Dial-on-Demand mode"); ?>
<br /> <span class="vexpl"><?= gettext("Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame."); ?></span> <div class="hidden" for="help_for_ondemand">
</td> <?= gettext("This option causes the interface to operate in dial-on-demand mode. Do NOT enable if you want your link to be always up. " .
</tr> "The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?> </span>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> </div>
<td width="22%" valign="top" class="vncell"><?=gettext("ProtoComp"); ?></td> </td>
<td width="78%" class="vtable"> </tr>
<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked=\"checked\""; ?> />&nbsp;<?= gettext("Disable protocomp (compression) (auto-negotiated by default)."); ?> <tr style="display:none" class="act_show_advanced">
<br /> <span class="vexpl"><?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?></span> <td><a id="help_for_idletimeout" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Idle Timeout"); ?></td>
</td> <td>
</tr> <input name="idletimeout" type="text" id="idletimeout" value="<?=$pconfig['idletimeout'];?>" />
<tr id="advanced_" name="advanced_"> <div class="hidden" for="help_for_idletimeout">
<td>&nbsp;</td> <?= gettext("(seconds) Default is 0, which disables the timeout feature."); ?></br><br/>
<td> <?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.");?>
<p><input type="button" onclick="show_advanced(1)" value="<?=gettext("Show advanced options"); ?>" class="btn btn-default btn-xs"/></p> <br /><?=gettext("When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed."); ?>
</td> </div>
<td style="display:none" id="adv_rows" name="adv_rows"><?=$k;?></td> </td>
<td style="display:none" id="adv_show" name="adv_show">0</td> </tr>
</tr> <tr style="display:none" class="act_show_advanced">
<?php for($i=0; $i < $port_count; $i++) : ?> <td><a id="help_for_vjcomp" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Compression"); ?></td>
<tr style="display:none" id="link<?=$i;?>"> <td>
<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> <?=gettext("Link Parameters");?></td> <input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?!empty($pconfig['vjcomp']) ? "checked=\"checked\"" :""; ?> />
<td class="vtable"> <?= gettext("Disable vjcomp(compression) (auto-negotiated by default)."); ?>
<table name="link_parameters" border="0" cellpadding="6" cellspacing="0" summary="link parameters" class="table table-striped"> <div class="hidden" for="help_for_vjcomp">
<tr> <?=gettext("This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. " .
<td width="22%" id="bwlabel<?=$i;?>" valign="top"class="vncell"> <?=gettext("Bandwidth");?></td> "You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time " .
<td width="78%" class="vtable"> "stamping or SACK, which modify TCP options between sequential packets.");?>
<br /><input name="bandwidth[]" id="bandwidth<?=$i;?>" type="text" class="form-control unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>" /> </div>
<br /> <span class="vexpl"><?=gettext("Set ONLY for MLPPP connections and ONLY when links have different bandwidths.");?></span> </td>
</td> </tr>
</tr> <tr style="display:none" class="act_show_advanced">
<tr> <td><a id="help_for_tcpmssfix" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("TCPmssFix"); ?></td>
<td width="22%" id="mtulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MTU"); ?></td> <td>
<td width="78%" class="vtable"> <input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?=!empty($pconfig['tcpmssfix']) ? "checked=\"checked\"" : ""; ?> />
<input name="mtu[]" id="mtu<?=$i;?>" type="text" class="form-control unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>" /> <?= gettext("Disable tcpmssfix (enabled by default)."); ?>
<br /> <span class="vexpl"><?=gettext("MTU will default to 1492.");?></span> <div class="hidden" for="help_for_tcpmssfix">
</td> <?=gettext("This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount ".
</tr> "allowed by the interface MTU. This is necessary in many setups to avoid problems caused by routers that drop ICMP Datagram Too Big messages. Without these messages, ".
<tr> "the originating machine sends data, it passes the rogue router then hits a machine that has an MTU that is not big enough for the data. Because the IP Don't Fragment option is set, ".
<td width="22%" id="mrulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MRU"); ?></td> "this machine sends an ICMP Datagram Too Big message back to the originator and drops the packet. The rogue router drops the ICMP message and the originator never ".
<td width="78%" class="vtable"> "gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.");?>
<input name="mru[]" id="mru<?=$i;?>" type="text" class="form-control unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>" /> </div>
<br /> <span class="vexpl">MRU <?=gettext("will be auto-negotiated by default.");?></span> </td>
</td> </tr>
</tr> <tr style="display:none" class="act_show_advanced">
<tr> <td><a id="help_for_shortseq" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("ShortSeq");?></td>
<td width="22%" id="mrrulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MRRU"); ?></td> <td>
<td width="78%" class="vtable"> <input type="checkbox" value="on" id="shortseq" name="shortseq" <?=!empty($pconfig['shortseq']) ? "checked=\"checked\"" : ""; ?> />
<input name="mrru[]" id="mrru<?=$i;?>" type="text" class="form-control unknown" size="6" value="<?=htmlspecialchars($pconfig['mrru'][$i]);?>" /> <?= gettext("Disable shortseq (auto-negotiated by default)."); ?>
<br /> <span class="vexpl"><?=gettext("Set ONLY for MLPPP connections.");?> MRRU <?=gettext("will be auto-negotiated by default.");?></span> <div class="hidden" for="help_for_shortseq">
</td> <?= gettext("This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame. " .
</tr> "It is not necessary to disable this for connections that are not multi-link."); ?>
</table> </div>
</td> </td>
</tr><?php endfor; ?> </tr>
<tr> <tr style="display:none" class="act_show_advanced">
<td width="22%" valign="top">&nbsp;</td> <td><a id="help_for_acfcomp" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("ACFComp"); ?></td>
<td width="78%"> <td>
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" /> <input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?=!empty($pconfig['acfcomp']) ? "checked=\"checked\"" : ""; ?> />
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> <?= gettext("Disable acfcomp (compression) (auto-negotiated by default)."); ?>
<input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>" /> <div class="hidden" for="help_for_acfcomp">
<?php if (isset($id) && $a_ppps[$id]): ?> <?= gettext("Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame."); ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> </div>
<?php endif; ?> </td>
</td> </tr>
</tr> <tr style="display:none" class="act_show_advanced">
</table> <td><a id="help_for_protocomp" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("ProtoComp"); ?></td>
</form> <td>
</div> <input type="checkbox" value="on" id="protocomp" name="protocomp" <?=!empty($pconfig['protocomp']) ? "checked=\"checked\"" :""; ?> />
</div> <?= gettext("Disable protocomp (compression) (auto-negotiated by default)."); ?>
</section> <div class="hidden" for="help_for_protocomp">
</div> <?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?>
</div> </div>
</section> </td>
</tr>
</tbody>
</table>
<table class="table table-striped act_show_advanced" style="display:none">
<tbody>
<?php
for ($intf_idx=0; $intf_idx <= max(count($serialports), count($portlist)) ; ++$intf_idx):?>
<tr style="display:none" class="intf_select_<?=$intf_idx;?>">
<td width="22%"> <a id="help_for_link_<?=$intf_idx;?>" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Link Parameters");?> <span class="intf_select_txt_<?=$intf_idx;?>"> </span></td>
<td width="78%">
<table class="table table-striped table-condensed">
<tr>
<td><?=gettext("Bandwidth");?></td>
<td>
<input name="bandwidth[]" class="intf_select_<?=$intf_idx;?>" type="text" value="<?=isset($pconfig['bandwidth'][$intf_idx]) ? $pconfig['bandwidth'][$intf_idx] : "";?>" />
</td>
</tr>
<tr>
<td><?=gettext("MTU"); ?></td>
<td>
<input name="mtu[]" class="intf_select_<?=$intf_idx;?>" type="text" value="<?=isset($pconfig['mtu'][$intf_idx]) ? $pconfig['mtu'][$intf_idx] : "";?>" />
</td>
</tr>
<tr>
<td><?=gettext("MRU"); ?></td>
<td>
<input name="mru[]" class="intf_select_<?=$intf_idx;?>" type="text" value="<?=isset($pconfig['mru'][$intf_idx]) ? $pconfig['mru'][$intf_idx] : "";?>" />
</td>
</tr>
<tr>
<td><?=gettext("MRRU"); ?></td>
<td>
<input name="mrru[]" class="intf_select_<?=$intf_idx;?>" type="text" value="<?=isset($pconfig['mrru'][$intf_idx]) ? $pconfig['mrru'][$intf_idx] : "";?>" />
</td>
</tr>
</table>
<div class="hidden" for="help_for_link_<?=$intf_idx;?>">
<ul>
<li><?=gettext("Bandwidth");?> : <?=gettext("Set ONLY for MLPPP connections and ONLY when links have different bandwidths.");?></li>
<li><?=gettext("MTU"); ?> : <?=gettext("MTU will default to 1492.");?></li>
<li><?=gettext("MRU"); ?> : <?=gettext("MRU");?> <?=gettext("will be auto-negotiated by default.");?></li>
<li><?=gettext("MRRU"); ?> : <?=gettext("Set ONLY for MLPPP connections.");?> <?=gettext("MRRU");?> <?=gettext("will be auto-negotiated by default.");?></li>
</ul>
</div>
</td>
</tr>
<?php
endfor;?>
</tbody>
</table>
<table class="table table-striped">
<tbody>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_ppps.php');?>'" />
<input name="ptpid" type="hidden" value="<?=$pconfig['ptpid'];?>" />
<?php if (isset($id)): ?>
<input name="id" type="hidden" value="<?=$id;?>" />
<?php endif; ?>
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
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