summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dnsmasq.php
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2016-11-16 18:28:41 -0500
committerSteve Beaver <sbeaver@netgate.com>2016-11-16 18:28:41 -0500
commit589634a9687f478ae3f2896159fb58a1cca9893f (patch)
tree01a32e36434569922a49e53d3c58c6c2105b58f9 /src/usr/local/www/services_dnsmasq.php
parentf399727871341cd0e2ebc68b2483deb6447acf27 (diff)
downloadpfsense-589634a9687f478ae3f2896159fb58a1cca9893f.zip
pfsense-589634a9687f478ae3f2896159fb58a1cca9893f.tar.gz
Revise host and domain sorting so that the index is not lost
Diffstat (limited to 'src/usr/local/www/services_dnsmasq.php')
-rw-r--r--src/usr/local/www/services_dnsmasq.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php
index 3e1ac46..fb74e7b 100644
--- a/src/usr/local/www/services_dnsmasq.php
+++ b/src/usr/local/www/services_dnsmasq.php
@@ -93,8 +93,21 @@ if (!is_array($config['dnsmasq']['domainoverrides'])) {
}
$a_hosts = &$config['dnsmasq']['hosts'];
+
+// Add a temporary index so we don't lose the order after sorting
+for ($idx=0; $idx<count($a_hosts); $idx++) {
+ $a_hosts[$idx]['idx'] = $idx;
+}
+
hosts_sort();
+
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
+
+// Add a temporary index so we don't lose the order after sorting
+for ($idx=0; $idx<count($a_domainOverrides); $idx++) {
+ $a_domainOverrides[$idx]['idx'] = $idx;
+}
+
domains_sort();
if ($_POST) {
@@ -373,8 +386,8 @@ foreach ($a_hosts as $i => $hostent):
<?=htmlspecialchars($hostent['descr'])?>
</td>
<td>
- <a class="fa fa-pencil" title="<?=gettext('Edit host override')?>" href="services_dnsmasq_edit.php?id=<?=$i?>"></a>
- <a class="fa fa-trash" title="<?=gettext('Delete host override')?>" href="services_dnsmasq.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
+ <a class="fa fa-pencil" title="<?=gettext('Edit host override')?>" href="services_dnsmasq_edit.php?id=<?=$hostent['idx']?>"></a>
+ <a class="fa fa-trash" title="<?=gettext('Delete host override')?>" href="services_dnsmasq.php?type=host&amp;act=del&amp;id=<?=$hostent['idx']?>"></a>
</td>
</tr>
@@ -445,8 +458,8 @@ foreach ($a_domainOverrides as $i => $doment):
<?=htmlspecialchars($doment['descr'])?>
</td>
<td>
- <a class="fa fa-pencil" title="<?=gettext('Edit domain override')?>" href="services_dnsmasq_domainoverride_edit.php?id=<?=$i?>"></a>
- <a class="fa fa-trash" title="<?=gettext('Delete domain override')?>" href="services_dnsmasq.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
+ <a class="fa fa-pencil" title="<?=gettext('Edit domain override')?>" href="services_dnsmasq_domainoverride_edit.php?id=<?=$doment['idx']?>"></a>
+ <a class="fa fa-trash" title="<?=gettext('Delete domain override')?>" href="services_dnsmasq.php?act=del&amp;type=doverride&amp;id=<?=$doment['idx']?>"></a>
</td>
</tr>
<?php
OpenPOWER on IntegriCloud