diff options
-rw-r--r-- | usr/local/www/interfaces_ppp.php | 18 | ||||
-rw-r--r-- | usr/local/www/interfaces_ppp_edit.php | 31 |
2 files changed, 18 insertions, 31 deletions
diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php index cb4df01..3ec6f9f 100644 --- a/usr/local/www/interfaces_ppp.php +++ b/usr/local/www/interfaces_ppp.php @@ -58,32 +58,16 @@ function ppp_inuse($num) { return false; } -function renumber_ppp($if, $delppp) { - if (!preg_match("/^ppp/", $if)) - return $if; - - $ppp = substr($if, 4); - if ($ppp > $delppp) - return "ppp" . ($ppp - 1); - else - return $if; -} - if ($_GET['act'] == "del") { /* check if still in use */ if (ppp_inuse($_GET['id'])) { $input_errors[] = "This PPP interface cannot be deleted because it is still being used as an interface."; } else { + mwexec("/sbin/ifconfig " . $a_ppps[$_GET['id']]['pppif'] . " destroy"); unset($a_ppps[$_GET['id']]); - $iflist = get_configured_interface_list(false, true); - foreach ($iflist as $if) - $config['interfaces'][$if]['if'] = renumber_ppp($config['interfaces'][$if]['if'], $_GET['id']); - write_config(); - interfaces_configure(); - header("Location: interfaces_ppp.php"); exit; } diff --git a/usr/local/www/interfaces_ppp_edit.php b/usr/local/www/interfaces_ppp_edit.php index b7c8e15..b492772 100644 --- a/usr/local/www/interfaces_ppp_edit.php +++ b/usr/local/www/interfaces_ppp_edit.php @@ -52,7 +52,8 @@ if (isset($_POST['id'])) $id = $_POST['id']; if (isset($id) && $a_ppps[$id]) { - $pconfig['if'] = $a_ppps[$id]['if']; + $pconfig['port'] = $a_ppps[$id]['port']; + $pconfig['pppif'] = $a_ppps[$id]['pppif']; $pconfig['initstr'] = $a_ppps[$id]['initstr']; $pconfig['phone'] = $a_ppps[$id]['phone']; $pconfig['linespeed'] = $a_ppps[$id]['linespeed']; @@ -87,18 +88,20 @@ if ($_POST) { $ppp['phone'] = $_POST['phone']; $ppp['linespeed'] = $_POST['linespeed']; $ppp['descr'] = $_POST['descr']; - - if (isset($id) && $a_ppps[$id]) - $a_ppps[$id] = $ppp; - else - $a_ppps[] = $ppp; - - write_config(); - - interfaces_configure(); - - header("Location: interfaces_ppp.php"); - exit; + $ppp['pppif'] = interface_ppp_configure($ppp); + if ($ppp['pppif'] == "" || !stristr($ppp['pppif'], "ppp")) + $input_errors[] = "Error occured creating interface, please retry."; + else { + if (isset($id) && $a_ppps[$id]) + $a_ppps[$id] = $ppp; + else + $a_ppps[] = $ppp; + + write_config(); + + header("Location: interfaces_ppp.php"); + exit; + } } } @@ -125,7 +128,7 @@ include("head.inc"); if(preg_match("/\.(lock|init)$/", $port)) continue; echo "<option value=\"{$port}\""; - if (false) + if ($pconfig['port'] = $port) echo "selected"; echo ">"; echo $port; |