diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-02-14 13:11:02 -0500 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-02-14 13:11:48 -0500 |
commit | c946d7217bff529d246084f9b83212ad0ab730a3 (patch) | |
tree | 6b0a616af17fe627985fb86237f1e55d68dca317 | |
parent | abdb35477d82643f3e091c3b6c4a321bff942eb4 (diff) | |
download | pfsense-c946d7217bff529d246084f9b83212ad0ab730a3.zip pfsense-c946d7217bff529d246084f9b83212ad0ab730a3.tar.gz |
GET/POST conversion - services part 1
-rwxr-xr-x | src/usr/local/www/interfaces.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/services_checkip.php | 24 | ||||
-rw-r--r-- | src/usr/local/www/services_checkip_edit.php | 4 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 29 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp_edit.php | 72 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6.php | 13 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6_edit.php | 23 |
7 files changed, 74 insertions, 94 deletions
diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index 0ba9a91..e00856d 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 cab0a6a..2b5f778 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&id=<?=$i?>"></a> + <a class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&id=<?=$i?>" usepost></a> <?php } else { ?> - <a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&id=<?=$i?>"></a> + <a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&id=<?=$i?>" usepost></a> <?php } ?> - <a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&id=<?=$i?>"></a> + <a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&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 e2475fe..1c2306e 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 9707292..bed5cfb 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)?>&id=<?=$i?>"></a> - <a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcp.php?if=<?=htmlspecialchars($if)?>&act=del&id=<?=$i?>"></a> + <a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcp.php?if=<?=htmlspecialchars($if)?>&act=del&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 3d702fd..2ab0848 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 a044a20..3762497 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?>&id=<?=$i?>"></a> - <a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&act=del&id=<?=$i?>"></a> + <a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&act=del&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 09b3051..a305a14 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."); |