commit c946d7217bff529d246084f9b83212ad0ab730a3
Author: Steve Beaver <sbeaver@netgate.com>
Date:   Tue Feb 14 13:11:02 2017 -0500

    GET/POST conversion - services part 1

diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php
index 0ba9a91cfd..e00856d0eb 100755
--- a/src/usr/local/www/interfaces.php
+++ b/src/usr/local/www/interfaces.php
@@ -53,6 +53,7 @@ if (isset($_POST['referer'])) {
 $ifdescrs = get_configured_interface_with_descr(false, true);
 
 $if = "wan";
+
 if ($_REQUEST['if']) {
 	$if = $_REQUEST['if'];
 }
@@ -461,7 +462,7 @@ if ($_POST['apply']) {
 		}
 	}
 	@unlink("{$g['tmp_path']}/.interfaces.apply");
-} else if ($_POST['submit]']) {
+} else if ($_POST['save']) {
 
 	unset($input_errors);
 	$pconfig = $_POST;
diff --git a/src/usr/local/www/services_checkip.php b/src/usr/local/www/services_checkip.php
index cab0a6a583..2b5f778376 100644
--- a/src/usr/local/www/services_checkip.php
+++ b/src/usr/local/www/services_checkip.php
@@ -35,18 +35,18 @@ if (!is_array($config['checkipservices']['checkipservice'])) {
 $a_checkipservice = &$config['checkipservices']['checkipservice'];
 
 $dirty = false;
-if ($_GET['act'] == "del") {
-	unset($a_checkipservice[$_GET['id']]);
+if ($_POST['act'] == "del") {
+	unset($a_checkipservice[$_POST['id']]);
 	$dirty = true;
-} else if ($_GET['act'] == "toggle") {
-	if ($a_checkipservice[$_GET['id']]) {
-		if (isset($a_checkipservice[$_GET['id']]['enable'])) {
-			unset($a_checkipservice[$_GET['id']]['enable']);
+} else if ($_POST['act'] == "toggle") {
+	if ($a_checkipservice[$_POST['id']]) {
+		if (isset($a_checkipservice[$_POST['id']]['enable'])) {
+			unset($a_checkipservice[$_POST['id']]['enable']);
 		} else {
-			$a_checkipservice[$_GET['id']]['enable'] = true;
+			$a_checkipservice[$_POST['id']]['enable'] = true;
 		}
 		$dirty = true;
-	} else if ($_GET['id'] == count($a_checkipservice)) {
+	} else if ($_POST['id'] == count($a_checkipservice)) {
 		if (isset($config['checkipservices']['disable_factory_default'])) {
 			unset($config['checkipservices']['disable_factory_default']);
 		} else {
@@ -130,13 +130,13 @@ foreach ($a_checkipservice as $checkipservice):
 							<a class="fa fa-pencil <?=$visibility?>" title="<?=gettext('Edit service')?>" href="services_checkip_edit.php?id=<?=$i?>"></a>
 						<?php if (isset($checkipservice['enable'])) {
 						?>
-							<a	class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
+							<a	class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&amp;id=<?=$i?>" usepost></a>
 						<?php } else {
 						?>
-							<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
+							<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&amp;id=<?=$i?>" usepost></a>
 						<?php }
 						?>
-							<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&amp;id=<?=$i?>"></a>
+							<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&amp;id=<?=$i?>" usepost></a>
 						</td>
 					</tr>
 <?php
@@ -162,7 +162,7 @@ endforeach; ?>
 	'as a string in the following format: ') .
 	'<pre>Current IP Address: x.x.x.x</pre>' .
 	gettext(
-	'The first (highest in list) enabled check ip service will be used to ' . 
+	'The first (highest in list) enabled check ip service will be used to ' .
 	'check IP addresses for Dynamic DNS services, and ' .
 	'RFC 2136 entries that have the "Use public IP" option enabled.') .
 	'<br/><br/>'
diff --git a/src/usr/local/www/services_checkip_edit.php b/src/usr/local/www/services_checkip_edit.php
index e2475fe46f..1c2306e75d 100644
--- a/src/usr/local/www/services_checkip_edit.php
+++ b/src/usr/local/www/services_checkip_edit.php
@@ -34,8 +34,8 @@ if (!is_array($config['checkipservices']['checkipservice'])) {
 
 $a_checkip = &$config['checkipservices']['checkipservice'];
 
-if (is_numericint($_GET['id'])) {
-	$id = $_GET['id'];
+if (is_numericint($_REQUEST['id'])) {
+	$id = $_REQUEST['id'];
 }
 
 if (isset($_POST['id']) && is_numericint($_POST['id'])) {
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index 9707292dbf..bed5cfb62b 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -40,10 +40,7 @@ if (!$g['services_dhcp_server_enable']) {
 	exit;
 }
 
-$if = $_GET['if'];
-if (!empty($_POST['if'])) {
-	$if = $_POST['if'];
-}
+$if = $_REQUEST['if'];
 
 /* if OLSRD is enabled, allow WAN to house DHCP. */
 if ($config['installedpackages']['olsrd']) {
@@ -105,15 +102,12 @@ if (!$if || !isset($iflist[$if])) {
 	}
 }
 
-$act = $_GET['act'];
-if (!empty($_POST['act'])) {
-	$act = $_POST['act'];
-}
+$act = $_REQUEST['act'];
 
 $a_pools = array();
 
 if (is_array($config['dhcpd'][$if])) {
-	$pool = $_GET['pool'];
+	$pool = $_REQUEST['pool'];
 	if (is_numeric($_POST['pool'])) {
 		$pool = $_POST['pool'];
 	}
@@ -144,6 +138,7 @@ if (is_array($config['dhcpd'][$if])) {
 
 	$a_maps = &$config['dhcpd'][$if]['staticmap'];
 }
+
 if (is_array($dhcpdconf)) {
 	// Global Options
 	if (!is_numeric($pool) && !($act == "newpool")) {
@@ -645,8 +640,8 @@ if ((isset($_POST['save']) || isset($_POST['apply'])) && (!$input_errors)) {
 }
 
 if ($act == "delpool") {
-	if ($a_pools[$_GET['id']]) {
-		unset($a_pools[$_GET['id']]);
+	if ($a_pools[$_POST['id']]) {
+		unset($a_pools[$_POST['id']]);
 		write_config();
 		header("Location: services_dhcp.php?if={$if}");
 		exit;
@@ -654,12 +649,12 @@ if ($act == "delpool") {
 }
 
 if ($act == "del") {
-	if (isset($a_maps[$_GET['id']])) {
+	if (isset($a_maps[$_POST['id']])) {
 		/* Remove static ARP entry, if necessary */
-		if (isset($a_maps[$_GET['id']]['arp_table_static_entry'])) {
-			mwexec("/usr/sbin/arp -d " . escapeshellarg($a_maps[$_GET['id']]['ipaddr']));
+		if (isset($a_maps[$_POST['id']]['arp_table_static_entry'])) {
+			mwexec("/usr/sbin/arp -d " . escapeshellarg($a_maps[$_POST['id']]['ipaddr']));
 		}
-		unset($a_maps[$_GET['id']]);
+		unset($a_maps[$_POST['id']]);
 		write_config();
 		if (isset($config['dhcpd'][$if]['enable'])) {
 			mark_subsystem_dirty('staticmaps');
@@ -705,7 +700,7 @@ function build_pooltable() {
 
 				$pooltbl .= '<td><a class="fa fa-pencil" title="'. gettext("Edit pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&pool=' . $i . '"></a>';
 
-				$pooltbl .= ' <a class="fa fa-trash" title="'. gettext("Delete pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&act=delpool&id=' . $i . '"></a></td>';
+				$pooltbl .= ' <a class="fa fa-trash" title="'. gettext("Delete pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&act=delpool&id=' . $i . '" usepost></a></td>';
 				$pooltbl .= '</tr>';
 			}
 		$i++;
@@ -1442,7 +1437,7 @@ if (!is_numeric($pool) && !($act == "newpool")) {
 						</td>
 						<td>
 							<a class="fa fa-pencil"	title="<?=gettext('Edit static mapping')?>"	href="services_dhcp_edit.php?if=<?=htmlspecialchars($if)?>&amp;id=<?=$i?>"></a>
-							<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>"	href="services_dhcp.php?if=<?=htmlspecialchars($if)?>&amp;act=del&amp;id=<?=$i?>"></a>
+							<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>"	href="services_dhcp.php?if=<?=htmlspecialchars($if)?>&amp;act=del&amp;id=<?=$i?>" usepost></a>
 						</td>
 					</tr>
 <?php
diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php
index 3d702fda5b..2ab08486e2 100644
--- a/src/usr/local/www/services_dhcp_edit.php
+++ b/src/usr/local/www/services_dhcp_edit.php
@@ -49,11 +49,7 @@ if (!$g['services_dhcp_server_enable']) {
 
 require_once("guiconfig.inc");
 
-$if = $_GET['if'];
-
-if ($_POST['if']) {
-	$if = $_POST['if'];
-}
+$if = $_REQUEST['if'];
 
 if (!$if) {
 	header("Location: services_dhcp.php");
@@ -63,9 +59,11 @@ if (!$if) {
 if (!is_array($config['dhcpd'])) {
 	$config['dhcpd'] = array();
 }
+
 if (!is_array($config['dhcpd'][$if])) {
 	$config['dhcpd'][$if] = array();
 }
+
 if (!is_array($config['dhcpd'][$if]['staticmap'])) {
 	$config['dhcpd'][$if]['staticmap'] = array();
 }
@@ -73,6 +71,7 @@ if (!is_array($config['dhcpd'][$if]['staticmap'])) {
 if (!is_array($config['dhcpd'][$if]['pool'])) {
 	$config['dhcpd'][$if]['pool'] = array();
 }
+
 $a_pools = &$config['dhcpd'][$if]['pool'];
 
 $static_arp_enabled=isset($config['dhcpd'][$if]['staticarp']);
@@ -82,12 +81,7 @@ $ifcfgip = get_interface_ip($if);
 $ifcfgsn = get_interface_subnet($if);
 $ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
 
-if (is_numericint($_GET['id'])) {
-	$id = $_GET['id'];
-}
-if (isset($_POST['id']) && is_numericint($_POST['id'])) {
-	$id = $_POST['id'];
-}
+$id = $_REQUEST['id'];
 
 if (isset($id) && $a_maps[$id]) {
 	$pconfig['mac'] = $a_maps[$id]['mac'];
@@ -114,36 +108,36 @@ if (isset($id) && $a_maps[$id]) {
 	list($pconfig['ntp1'], $pconfig['ntp2']) = $a_maps[$id]['ntpserver'];
 	$pconfig['tftp'] = $a_maps[$id]['tftp'];
 } else {
-	$pconfig['mac'] = $_GET['mac'];
-	$pconfig['cid'] = $_GET['cid'];
-	$pconfig['hostname'] = $_GET['hostname'];
-	$pconfig['filename'] = $_GET['filename'];
-	$pconfig['rootpath'] = $_GET['rootpath'];
-	$pconfig['descr'] = $_GET['descr'];
-	$pconfig['arp_table_static_entry'] = $_GET['arp_table_static_entry'];
-	$pconfig['deftime'] = $_GET['defaultleasetime'];
-	$pconfig['maxtime'] = $_GET['maxleasetime'];
-	$pconfig['gateway'] = $_GET['gateway'];
-	$pconfig['domain'] = $_GET['domain'];
-	$pconfig['domainsearchlist'] = $_GET['domainsearchlist'];
-	$pconfig['wins1'] = $_GET['wins1'];
-	$pconfig['wins2'] = $_GET['wins2'];
-	$pconfig['dns1'] = $_GET['dns1'];
-	$pconfig['dns2'] = $_GET['dns2'];
-	$pconfig['dns3'] = $_GET['dns3'];
-	$pconfig['dns4'] = $_GET['dns4'];
-	$pconfig['ddnsdomain'] = $_GET['ddnsdomain'];
-	$pconfig['ddnsdomainprimary'] = $_GET['ddnsdomainprimary'];
-	$pconfig['ddnsdomainkeyname'] = $_GET['ddnsdomainkeyname'];
-	$pconfig['ddnsdomainkey'] = $_GET['ddnsdomainkey'];
-	$pconfig['ddnsupdate'] = isset($_GET['ddnsupdate']);
-	$pconfig['ddnsforcehostname'] = isset($_GET['ddnsforcehostname']);
-	$pconfig['ntp1'] = $_GET['ntp1'];
-	$pconfig['ntp2'] = $_GET['ntp2'];
-	$pconfig['tftp'] = $_GET['tftp'];
+	$pconfig['mac'] = $_REQUEST['mac'];
+	$pconfig['cid'] = $_REQUEST['cid'];
+	$pconfig['hostname'] = $_REQUEST['hostname'];
+	$pconfig['filename'] = $_REQUEST['filename'];
+	$pconfig['rootpath'] = $_REQUEST['rootpath'];
+	$pconfig['descr'] = $_REQUEST['descr'];
+	$pconfig['arp_table_static_entry'] = $_REQUEST['arp_table_static_entry'];
+	$pconfig['deftime'] = $_REQUEST['defaultleasetime'];
+	$pconfig['maxtime'] = $_REQUEST['maxleasetime'];
+	$pconfig['gateway'] = $_REQUEST['gateway'];
+	$pconfig['domain'] = $_REQUEST['domain'];
+	$pconfig['domainsearchlist'] = $_REQUEST['domainsearchlist'];
+	$pconfig['wins1'] = $_REQUEST['wins1'];
+	$pconfig['wins2'] = $_REQUEST['wins2'];
+	$pconfig['dns1'] = $_REQUEST['dns1'];
+	$pconfig['dns2'] = $_REQUEST['dns2'];
+	$pconfig['dns3'] = $_REQUEST['dns3'];
+	$pconfig['dns4'] = $_REQUEST['dns4'];
+	$pconfig['ddnsdomain'] = $_REQUEST['ddnsdomain'];
+	$pconfig['ddnsdomainprimary'] = $_REQUEST['ddnsdomainprimary'];
+	$pconfig['ddnsdomainkeyname'] = $_REQUEST['ddnsdomainkeyname'];
+	$pconfig['ddnsdomainkey'] = $_REQUEST['ddnsdomainkey'];
+	$pconfig['ddnsupdate'] = isset($_REQUEST['ddnsupdate']);
+	$pconfig['ddnsforcehostname'] = isset($_REQUEST['ddnsforcehostname']);
+	$pconfig['ntp1'] = $_REQUEST['ntp1'];
+	$pconfig['ntp2'] = $_REQUEST['ntp2'];
+	$pconfig['tftp'] = $_REQUEST['tftp'];
 }
 
-if ($_POST) {
+if ($_POST['save']) {
 	unset($input_errors);
 	$pconfig = $_POST;
 
diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php
index a044a20169..3762497dbd 100644
--- a/src/usr/local/www/services_dhcpv6.php
+++ b/src/usr/local/www/services_dhcpv6.php
@@ -75,10 +75,7 @@ if (!$g['services_dhcp_server_enable']) {
 	exit;
 }
 
-$if = $_GET['if'];
-if ($_POST['if']) {
-	$if = $_POST['if'];
-}
+$if = $_REQUEST['if'];
 
 /* if OLSRD is enabled, allow WAN to house DHCP. */
 if ($config['installedpackages']['olsrd']) {
@@ -465,9 +462,9 @@ if (isset($_POST['apply'])) {
 	}
 }
 
-if ($_GET['act'] == "del") {
-	if ($a_maps[$_GET['id']]) {
-		unset($a_maps[$_GET['id']]);
+if ($_POST['act'] == "del") {
+	if ($a_maps[$_POST['id']]) {
+		unset($a_maps[$_POST['id']]);
 		write_config();
 		if (isset($config['dhcpdv6'][$if]['enable'])) {
 			mark_subsystem_dirty('staticmapsv6');
@@ -1033,7 +1030,7 @@ if (is_array($a_maps)):
 					</td>
 					<td>
 						<a class="fa fa-pencil"	title="<?=gettext('Edit static mapping')?>" href="services_dhcpv6_edit.php?if=<?=$if?>&amp;id=<?=$i?>"></a>
-						<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&amp;act=del&amp;id=<?=$i?>"></a>
+						<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&amp;act=del&amp;id=<?=$i?>" usepost></a>
 					</td>
 				</tr>
 <?php
diff --git a/src/usr/local/www/services_dhcpv6_edit.php b/src/usr/local/www/services_dhcpv6_edit.php
index 09b3051208..a305a1495e 100644
--- a/src/usr/local/www/services_dhcpv6_edit.php
+++ b/src/usr/local/www/services_dhcpv6_edit.php
@@ -50,10 +50,7 @@ if (!$g['services_dhcp_server_enable']) {
 
 require_once("guiconfig.inc");
 
-$if = $_GET['if'];
-if ($_POST['if']) {
-	$if = $_POST['if'];
-}
+$if = $_REQUEST['if'];
 
 if (!$if) {
 	header("Location: services_dhcpv6.php");
@@ -76,12 +73,7 @@ $ifcfgipv6 = get_interface_ipv6($if);
 $ifcfgsnv6 = get_interface_subnetv6($if);
 $ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
 
-if (is_numericint($_GET['id'])) {
-	$id = $_GET['id'];
-}
-if (isset($_POST['id']) && is_numericint($_POST['id'])) {
-	$id = $_POST['id'];
-}
+$id = $_REQUEST['id'];
 
 if (isset($id) && $a_maps[$id]) {
 	$pconfig['duid'] = $a_maps[$id]['duid'];
@@ -91,14 +83,14 @@ if (isset($id) && $a_maps[$id]) {
 	$pconfig['rootpath'] = $a_maps[$id]['rootpath'];
 	$pconfig['descr'] = $a_maps[$id]['descr'];
 } else {
-	$pconfig['duid'] = $_GET['duid'];
-	$pconfig['hostname'] = $_GET['hostname'];
-	$pconfig['filename'] = $_GET['filename'];
+	$pconfig['duid'] = $_REQUEST['duid'];
+	$pconfig['hostname'] = $_REQUEST['hostname'];
+	$pconfig['filename'] = $_REQUEST['filename'];
 	$pconfig['rootpath'] = $a_maps[$id]['rootpath'];
-	$pconfig['descr'] = $_GET['descr'];
+	$pconfig['descr'] = $_REQUEST['descr'];
 }
 
-if ($_POST) {
+if ($_POST['save']) {
 
 	unset($input_errors);
 	$pconfig = $_POST;
@@ -122,6 +114,7 @@ if ($_POST) {
 			}
 		}
 	}
+
 	if ($_POST['ipaddrv6']) {
 		if (!is_ipaddrv6($_POST['ipaddrv6'])) {
 			$input_errors[] = gettext("A valid IPv6 address must be specified.");
