Project

General

Profile

« Previous | Next » 

Revision b6db8ea3

Added by Scott Ullrich almost 16 years ago

Check for interfaces with same name as alias. Ticket #92

View differences:

usr/local/www/firewall_aliases_edit.php
60 60
if($debug)
61 61
	exec("rm -f {$g['tmp_path']}/alias_rename_log.txt");
62 62

  
63
function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, $new_alias_name) {
64
	global $g, $config, $pconfig, $origname, $debug;
65
	if(!$origname) 
66
		return;
67

  
68
	if($debug) $fd = fopen("{$g['tmp_path']}/print_r", "a");
69
	if($debug) fwrite($fd, print_r($pconfig, true));
70

  
71
	if($fieldb) {
72
		if($debug) fwrite($fd, "fieldb exists\n");
73
		for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) {
74
			if($debug) fwrite($fd, "$i\n");
75
			if($config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] == $origname) {
76
				if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n");
77
				$config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] = $new_alias_name;
78
			}
79
		}	
80
	} else {
81
		if($debug) fwrite($fd, "fieldb does not exist\n");
82
		for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) {
83
			if($config["$section"]["$subsection"][$i]["$fielda"] == $origname) {
84
				$config["$section"]["$subsection"][$i]["$fielda"] = $new_alias_name;
85
				if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n");
86
			}
87
		}
88
	}
89

  
90
	if($debug) fclose($fd);
91

  
92
}
93

  
94 63
function alias_same_type($name, $type) {
95 64
	global $config;
96 65
	

Also available in: Unified diff