From 6c05cfb07b246ffa3af8ce42a8e12f0e83966de4 Mon Sep 17 00:00:00 2001 From: gnhb Date: Sat, 29 May 2010 21:30:57 +0700 Subject: Delete the interface_ppp_configure function and change how PPP data is saved. PPP data entered in interfaces.php was clobbering data that didn't have associated fields in this page. Fixed now. Also, add a little PPP section to interfaces.php file to point users in the right place to create the configuration. --- usr/local/www/interfaces.php | 98 +++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 37 deletions(-) (limited to 'usr') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 1cda057..bef6ad7 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -554,28 +554,28 @@ if ($_POST) { } break; case "pppoe": - $ppp['ptpid'] = $_POST['ptpid']; - $ppp['type'] = $_POST['type']; + $a_ppps[$pppid]['ptpid'] = $_POST['ptpid']; + $a_ppps[$pppid]['type'] = $_POST['type']; if (isset($_POST['ppp_port'])) - $ppp['ports'] = $_POST['ppp_port']; + $a_ppps[$pppid]['ports'] = $_POST['ppp_port']; else - $ppp['ports'] = $wancfg['if']; - $ppp['username'] = $_POST['pppoe_username']; - $ppp['password'] = base64_encode($_POST['pppoe_password']); + $a_ppps[$pppid]['ports'] = $wancfg['if']; + $a_ppps[$pppid]['username'] = $_POST['pppoe_username']; + $a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']); if (!empty($_POST['provider'])) - $ppp['provider'] = $_POST['provider']; + $a_ppps[$pppid]['provider'] = $_POST['provider']; else - unset($ppp['provider']); - $ppp['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false; + unset($a_ppps[$pppid]['provider']); + $a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false; if (!empty($_POST['idletimeout'])) - $ppp['idletimeout'] = $_POST['pppoe_idletimeout']; + $a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout']; else - unset($ppp['idletimeout']); + unset($a_ppps[$pppid]['idletimeout']); if (!empty($_POST['pppoe-reset-type'])) - $ppp['pppoe-reset-type'] = $_POST['pppoe-reset-type']; + $a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type']; else - unset($ppp['pppoe-reset-type']); + unset($a_ppps[$pppid]['pppoe-reset-type']); $wancfg['if'] = $_POST['type'] . $if_num; $wancfg['ptpid'] = $_POST['ptpid']; $wancfg['ipaddr'] = $_POST['type']; @@ -585,22 +585,22 @@ if ($_POST) { break; case "pptp": - $ppp['ptpid'] = $_POST['ptpid']; - $ppp['type'] = $_POST['type']; + $a_ppps[$pppid]['ptpid'] = $_POST['ptpid']; + $a_ppps[$pppid]['type'] = $_POST['type']; if (isset($_POST['ppp_port'])) - $ppp['ports'] = $_POST['ppp_port']; + $a_ppps[$pppid]['ports'] = $_POST['ppp_port']; else - $ppp['ports'] = $wancfg['if']; - $ppp['username'] = $_POST['pptp_username']; - $ppp['password'] = base64_encode($_POST['pptp_password']); - $ppp['localip'] = $_POST['pptp_local']; - $ppp['subnet'] = $_POST['pptp_subnet']; - $ppp['gateway'] = $_POST['pptp_remote']; - $ppp['ondemand'] = $_POST['pptp_dialondemand'] ? true : false; + $a_ppps[$pppid]['ports'] = $wancfg['if']; + $a_ppps[$pppid]['username'] = $_POST['pptp_username']; + $a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']); + $a_ppps[$pppid]['localip'] = $_POST['pptp_local']; + $a_ppps[$pppid]['subnet'] = $_POST['pptp_subnet']; + $a_ppps[$pppid]['gateway'] = $_POST['pptp_remote']; + $a_ppps[$pppid]['ondemand'] = $_POST['pptp_dialondemand'] ? true : false; if (!empty($_POST['idletimeout'])) - $ppp['idletimeout'] = $_POST['pptp_idletimeout']; + $a_ppps[$pppid]['idletimeout'] = $_POST['pptp_idletimeout']; else - unset($ppp['idletimeout']); + unset($a_ppps[$pppid]['idletimeout']); $wancfg['if'] = $_POST['type'] . $if_num; $wancfg['ptpid'] = $_POST['ptpid']; @@ -609,6 +609,8 @@ if ($_POST) { $a_gateways[] = $gateway_item; } break; + case "none": + break; } handle_pppoe_reset(); /* reset cron items if necessary */ @@ -639,11 +641,6 @@ if ($_POST) { handle_wireless_post(); } - if (isset($_POST['pppid']) && $a_ppps[$pppid]) - $a_ppps[$pppid] = $ppp; - else - $a_ppps[] = $ppp; - write_config(); mark_subsystem_dirty('interfaces'); /* regenerate cron settings/crontab file */ @@ -874,7 +871,7 @@ function check_wireless_mode() { $pgtitle = array("Interfaces", $pconfig['descr']); $closehead = false; include("head.inc"); -$types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/); +$types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/); ?> @@ -887,23 +884,27 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" function updateType(t) { switch(t) { case "none": { - $('static','dhcp','pppoe','pptp').invoke('hide'); + $('static','dhcp','pppoe','pptp', 'ppp').invoke('hide'); break; } case "static": { - $('none','dhcp','pppoe','pptp').invoke('hide'); + $('none','dhcp','pppoe','pptp', 'ppp').invoke('hide'); break; } case "dhcp": { - $('none','static','pppoe','pptp').invoke('hide'); + $('none','static','pppoe','pptp', 'ppp').invoke('hide'); + break; + } + case "ppp": { + $('none','static','dhcp','pptp', 'pppoe').invoke('hide'); break; } case "pppoe": { - $('none','static','dhcp','pptp').invoke('hide'); + $('none','static','dhcp','pptp', 'ppp').invoke('hide'); break; } case "pptp": { - $('none','static','dhcp','pppoe').invoke('hide'); + $('none','static','dhcp','pppoe', 'ppp').invoke('hide'); break; } } @@ -1172,6 +1173,29 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" + + + + + + + + + + + + + + +
PPP configuration
PPP + Click here + to edit PPP configuration. + + Click here + to create a PPP configuration. +
+ + @@ -1273,7 +1297,6 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" -
@@ -1852,6 +1875,7 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" else echo "show_allcfg(document.iform.enable);"; echo "updateType('{$pconfig['type']}');\n"; + ?> -- cgit v1.1