From afe88d69235f84530ed6386b22cfc9c488bf94c5 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 12 Sep 2011 22:30:37 +0000 Subject: Another try at prventing panic on reconfig of ppp type wans. Ticket #1696 --- usr/local/www/wizards/setup_wizard.xml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index 01d1e5c..5cb794b 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -420,19 +420,18 @@ } $type = $_POST['selectedtype']; - if (!is_array($config['ppps']['ppp'])) - $config['ppps']['ppp'] = array(); - if (count($config['ppps']['ppp'])) { - foreach ($config['ppps']['ppp'] as $pppid => $ppp) { - if ($ppp['ptpid'] == "0") { - if ((substr($config['interfaces']['wan']['if'],0,5) == "pppoe") || (substr($config['interfaces']['wan']['if'],0,4) == "pptp")) { - $oldif = explode(",", $ppp['ports']); - $config['interfaces']['wan']['if'] = $oldif[0]; - } - if ($type == "pppoe" || $type == "pptp") - unset($config['ppps']['ppp'][$pppid]); - } - } + $wanif = ""; + if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { + foreach ($config['ppps']['ppp'] as $pppid => $ppp) { + if ($realif == $ppp['if']) { + $ifaces = explode(",", $ppp['ports']); + $wanif = $ifaces[0]; + } + } + } + if (!empty($wanif)) { + $config['interfaces']['wan']['if'] = $wanif; + unset($config['ppps']['ppp'][$pppid]); } if ($type == "pppoe" || $type == "pptp") { -- cgit v1.1