Project

General

Profile

« Previous | Next » 

Revision 3ea92441

Added by jburel-clever-age about 7 years ago

Fix ID issues when edit/delete DNS Forwarding rule

View differences:

src/usr/local/www/services_dnsmasq.php
50 50
		return;
51 51
	}
52 52

  
53
	usort($a_hosts, "hostcmp");
53
	uasort($a_hosts, "hostcmp");
54 54
}
55 55

  
56 56
// Sort domain entries for display in alphabetical order
......
65 65
		return;
66 66
	}
67 67

  
68
	usort($a_domainOverrides, "domaincmp");
68
	uasort($a_domainOverrides, "domaincmp");
69 69
}
70 70

  
71 71
$pconfig['enable'] = isset($config['dnsmasq']['enable']);
......
188 188

  
189 189
if ($_POST['act'] == "del") {
190 190
	if ($_POST['type'] == 'host') {
191
		// it gets sorted by hostname on load
192
		// sort it by index so it deletes the correct one.
193
		usort($a_hosts, function($a,$b){
194
			return($a['idx'] > $b['idx']);
195
		});
196

  
197 191
		if ($a_hosts[$_POST['id']]) {
198 192
			unset($a_hosts[$_POST['id']]);
199 193
			write_config();
......
202 196
			exit;
203 197
		}
204 198
	} elseif ($_POST['type'] == 'doverride') {
205
		// gets sorted by name on load
206
		// sort by index to delete the correct one.
207
		usort($a_domainOverrides, function($a,$b){
208
			return($a['idx'] > $b['idx']);
209
		});
210

  
211 199
		if ($a_domainOverrides[$_POST['id']]) {
212 200
			unset($a_domainOverrides[$_POST['id']]);
213 201
			write_config();

Also available in: Unified diff