diff options
author | jim-p <jimp@pfsense.org> | 2011-08-03 12:35:17 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-08-03 12:39:29 -0400 |
commit | 448cc756b110d2334a8db25e60c5cf322609fda5 (patch) | |
tree | 5616180767d632730dc8bbd62451a7b4e0d63e75 /usr/local/www/interfaces_ppps.php | |
parent | 090d2bdcd90c8440d16421a3f00112eb9664e19b (diff) | |
download | pfsense-448cc756b110d2334a8db25e60c5cf322609fda5.zip pfsense-448cc756b110d2334a8db25e60c5cf322609fda5.tar.gz |
Work around the fact that get_configured_interface_list re-parses the config and kills the reference made before it, which was making it impossible to delete a pppoe instance.
Diffstat (limited to 'usr/local/www/interfaces_ppps.php')
-rw-r--r-- | usr/local/www/interfaces_ppps.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/usr/local/www/interfaces_ppps.php b/usr/local/www/interfaces_ppps.php index 1e22bd0..2b5329a 100644 --- a/usr/local/www/interfaces_ppps.php +++ b/usr/local/www/interfaces_ppps.php @@ -43,16 +43,14 @@ require("guiconfig.inc"); require_once("functions.inc"); -if (!is_array($config['ppps']['ppp'])) - $config['ppps']['ppp'] = array(); - -$a_ppps = &$config['ppps']['ppp'] ; - function ppp_inuse($num) { - global $config, $g, $a_ppps; + global $config, $g; $iflist = get_configured_interface_list(false, true); + if (!is_array($config['ppps']['ppp'])) + return false; + foreach ($iflist as $if) { - if ($config['interfaces'][$if]['if'] == $a_ppps[$num]['if']) + if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) return true; } return false; @@ -62,16 +60,21 @@ if ($_GET['act'] == "del") { /* check if still in use */ if (ppp_inuse($_GET['id'])) { $input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface."); - } else { - unset($a_ppps[$_GET['id']]['pppoe-reset-type']); - handle_pppoe_reset($a_ppps[$_GET['id']]); - unset($a_ppps[$_GET['id']]); + } elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) { + + unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']); + handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]); + unset($config['ppps']['ppp'][$_GET['id']]); write_config(); header("Location: interfaces_ppps.php"); exit; } } +if (!is_array($config['ppps']['ppp'])) + $config['ppps']['ppp'] = array(); +$a_ppps = $config['ppps']['ppp']; + $pgtitle = gettext("Interfaces: PPPs"); include("head.inc"); |