Project

General

Profile

« Previous | Next » 

Revision 448cc756

Added by Jim Pingle almost 14 years ago

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.

View differences:

usr/local/www/interfaces_ppps.php
43 43
require("guiconfig.inc");
44 44
require_once("functions.inc");
45 45

  
46
if (!is_array($config['ppps']['ppp']))
47
	$config['ppps']['ppp'] = array();
48

  
49
$a_ppps = &$config['ppps']['ppp'] ;
50

  
51 46
function ppp_inuse($num) {
52
	global $config, $g, $a_ppps;
47
	global $config, $g;
53 48
	$iflist = get_configured_interface_list(false, true);
49
	if (!is_array($config['ppps']['ppp']))
50
		return false;
51

  
54 52
	foreach ($iflist as $if) {
55
		if ($config['interfaces'][$if]['if'] == $a_ppps[$num]['if'])
53
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if'])
56 54
			return true;
57 55
	}
58 56
	return false;
......
62 60
	/* check if still in use */
63 61
	if (ppp_inuse($_GET['id'])) {
64 62
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
65
	} else {
66
		unset($a_ppps[$_GET['id']]['pppoe-reset-type']);
67
		handle_pppoe_reset($a_ppps[$_GET['id']]);
68
		unset($a_ppps[$_GET['id']]);
63
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
64

  
65
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
66
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
67
		unset($config['ppps']['ppp'][$_GET['id']]);
69 68
		write_config();
70 69
		header("Location: interfaces_ppps.php");
71 70
		exit;
72 71
	}
73 72
}
74 73

  
74
if (!is_array($config['ppps']['ppp']))
75
	$config['ppps']['ppp'] = array();
76
$a_ppps = $config['ppps']['ppp'];
77

  
75 78
$pgtitle = gettext("Interfaces: PPPs");
76 79
include("head.inc");
77 80

  

Also available in: Unified diff