Project

General

Profile

« Previous | Next » 

Revision c946d721

Added by Steve Beaver over 8 years ago

GET/POST conversion - services part 1

View differences:

src/usr/local/www/interfaces.php
53 53
$ifdescrs = get_configured_interface_with_descr(false, true);
54 54

  
55 55
$if = "wan";
56

  
56 57
if ($_REQUEST['if']) {
57 58
	$if = $_REQUEST['if'];
58 59
}
......
461 462
		}
462 463
	}
463 464
	@unlink("{$g['tmp_path']}/.interfaces.apply");
464
} else if ($_POST['submit]']) {
465
} else if ($_POST['save']) {
465 466

  
466 467
	unset($input_errors);
467 468
	$pconfig = $_POST;
src/usr/local/www/services_checkip.php
35 35
$a_checkipservice = &$config['checkipservices']['checkipservice'];
36 36

  
37 37
$dirty = false;
38
if ($_GET['act'] == "del") {
39
	unset($a_checkipservice[$_GET['id']]);
38
if ($_POST['act'] == "del") {
39
	unset($a_checkipservice[$_POST['id']]);
40 40
	$dirty = true;
41
} else if ($_GET['act'] == "toggle") {
42
	if ($a_checkipservice[$_GET['id']]) {
43
		if (isset($a_checkipservice[$_GET['id']]['enable'])) {
44
			unset($a_checkipservice[$_GET['id']]['enable']);
41
} else if ($_POST['act'] == "toggle") {
42
	if ($a_checkipservice[$_POST['id']]) {
43
		if (isset($a_checkipservice[$_POST['id']]['enable'])) {
44
			unset($a_checkipservice[$_POST['id']]['enable']);
45 45
		} else {
46
			$a_checkipservice[$_GET['id']]['enable'] = true;
46
			$a_checkipservice[$_POST['id']]['enable'] = true;
47 47
		}
48 48
		$dirty = true;
49
	} else if ($_GET['id'] == count($a_checkipservice)) {
49
	} else if ($_POST['id'] == count($a_checkipservice)) {
50 50
		if (isset($config['checkipservices']['disable_factory_default'])) {
51 51
			unset($config['checkipservices']['disable_factory_default']);
52 52
		} else {
......
130 130
							<a class="fa fa-pencil <?=$visibility?>" title="<?=gettext('Edit service')?>" href="services_checkip_edit.php?id=<?=$i?>"></a>
131 131
						<?php if (isset($checkipservice['enable'])) {
132 132
						?>
133
							<a	class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
133
							<a	class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&amp;id=<?=$i?>" usepost></a>
134 134
						<?php } else {
135 135
						?>
136
							<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
136
							<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&amp;id=<?=$i?>" usepost></a>
137 137
						<?php }
138 138
						?>
139
							<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&amp;id=<?=$i?>"></a>
139
							<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&amp;id=<?=$i?>" usepost></a>
140 140
						</td>
141 141
					</tr>
142 142
<?php
......
162 162
	'as a string in the following format: ') .
163 163
	'<pre>Current IP Address: x.x.x.x</pre>' .
164 164
	gettext(
165
	'The first (highest in list) enabled check ip service will be used to ' . 
165
	'The first (highest in list) enabled check ip service will be used to ' .
166 166
	'check IP addresses for Dynamic DNS services, and ' .
167 167
	'RFC 2136 entries that have the "Use public IP" option enabled.') .
168 168
	'<br/><br/>'
src/usr/local/www/services_checkip_edit.php
34 34

  
35 35
$a_checkip = &$config['checkipservices']['checkipservice'];
36 36

  
37
if (is_numericint($_GET['id'])) {
38
	$id = $_GET['id'];
37
if (is_numericint($_REQUEST['id'])) {
38
	$id = $_REQUEST['id'];
39 39
}
40 40

  
41 41
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
src/usr/local/www/services_dhcp.php
40 40
	exit;
41 41
}
42 42

  
43
$if = $_GET['if'];
44
if (!empty($_POST['if'])) {
45
	$if = $_POST['if'];
46
}
43
$if = $_REQUEST['if'];
47 44

  
48 45
/* if OLSRD is enabled, allow WAN to house DHCP. */
49 46
if ($config['installedpackages']['olsrd']) {
......
105 102
	}
106 103
}
107 104

  
108
$act = $_GET['act'];
109
if (!empty($_POST['act'])) {
110
	$act = $_POST['act'];
111
}
105
$act = $_REQUEST['act'];
112 106

  
113 107
$a_pools = array();
114 108

  
115 109
if (is_array($config['dhcpd'][$if])) {
116
	$pool = $_GET['pool'];
110
	$pool = $_REQUEST['pool'];
117 111
	if (is_numeric($_POST['pool'])) {
118 112
		$pool = $_POST['pool'];
119 113
	}
......
144 138

  
145 139
	$a_maps = &$config['dhcpd'][$if]['staticmap'];
146 140
}
141

  
147 142
if (is_array($dhcpdconf)) {
148 143
	// Global Options
149 144
	if (!is_numeric($pool) && !($act == "newpool")) {
......
645 640
}
646 641

  
647 642
if ($act == "delpool") {
648
	if ($a_pools[$_GET['id']]) {
649
		unset($a_pools[$_GET['id']]);
643
	if ($a_pools[$_POST['id']]) {
644
		unset($a_pools[$_POST['id']]);
650 645
		write_config();
651 646
		header("Location: services_dhcp.php?if={$if}");
652 647
		exit;
......
654 649
}
655 650

  
656 651
if ($act == "del") {
657
	if (isset($a_maps[$_GET['id']])) {
652
	if (isset($a_maps[$_POST['id']])) {
658 653
		/* Remove static ARP entry, if necessary */
659
		if (isset($a_maps[$_GET['id']]['arp_table_static_entry'])) {
660
			mwexec("/usr/sbin/arp -d " . escapeshellarg($a_maps[$_GET['id']]['ipaddr']));
654
		if (isset($a_maps[$_POST['id']]['arp_table_static_entry'])) {
655
			mwexec("/usr/sbin/arp -d " . escapeshellarg($a_maps[$_POST['id']]['ipaddr']));
661 656
		}
662
		unset($a_maps[$_GET['id']]);
657
		unset($a_maps[$_POST['id']]);
663 658
		write_config();
664 659
		if (isset($config['dhcpd'][$if]['enable'])) {
665 660
			mark_subsystem_dirty('staticmaps');
......
705 700

  
706 701
				$pooltbl .= '<td><a class="fa fa-pencil" title="'. gettext("Edit pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&pool=' . $i . '"></a>';
707 702

  
708
				$pooltbl .= ' <a class="fa fa-trash" title="'. gettext("Delete pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&act=delpool&id=' . $i . '"></a></td>';
703
				$pooltbl .= ' <a class="fa fa-trash" title="'. gettext("Delete pool") . '" href="services_dhcp.php?if=' . htmlspecialchars($if) . '&act=delpool&id=' . $i . '" usepost></a></td>';
709 704
				$pooltbl .= '</tr>';
710 705
			}
711 706
		$i++;
......
1442 1437
						</td>
1443 1438
						<td>
1444 1439
							<a class="fa fa-pencil"	title="<?=gettext('Edit static mapping')?>"	href="services_dhcp_edit.php?if=<?=htmlspecialchars($if)?>&amp;id=<?=$i?>"></a>
1445
							<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>"	href="services_dhcp.php?if=<?=htmlspecialchars($if)?>&amp;act=del&amp;id=<?=$i?>"></a>
1440
							<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>
1446 1441
						</td>
1447 1442
					</tr>
1448 1443
<?php
src/usr/local/www/services_dhcp_edit.php
49 49

  
50 50
require_once("guiconfig.inc");
51 51

  
52
$if = $_GET['if'];
53

  
54
if ($_POST['if']) {
55
	$if = $_POST['if'];
56
}
52
$if = $_REQUEST['if'];
57 53

  
58 54
if (!$if) {
59 55
	header("Location: services_dhcp.php");
......
63 59
if (!is_array($config['dhcpd'])) {
64 60
	$config['dhcpd'] = array();
65 61
}
62

  
66 63
if (!is_array($config['dhcpd'][$if])) {
67 64
	$config['dhcpd'][$if] = array();
68 65
}
66

  
69 67
if (!is_array($config['dhcpd'][$if]['staticmap'])) {
70 68
	$config['dhcpd'][$if]['staticmap'] = array();
71 69
}
......
73 71
if (!is_array($config['dhcpd'][$if]['pool'])) {
74 72
	$config['dhcpd'][$if]['pool'] = array();
75 73
}
74

  
76 75
$a_pools = &$config['dhcpd'][$if]['pool'];
77 76

  
78 77
$static_arp_enabled=isset($config['dhcpd'][$if]['staticarp']);
......
82 81
$ifcfgsn = get_interface_subnet($if);
83 82
$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
84 83

  
85
if (is_numericint($_GET['id'])) {
86
	$id = $_GET['id'];
87
}
88
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
89
	$id = $_POST['id'];
90
}
84
$id = $_REQUEST['id'];
91 85

  
92 86
if (isset($id) && $a_maps[$id]) {
93 87
	$pconfig['mac'] = $a_maps[$id]['mac'];
......
114 108
	list($pconfig['ntp1'], $pconfig['ntp2']) = $a_maps[$id]['ntpserver'];
115 109
	$pconfig['tftp'] = $a_maps[$id]['tftp'];
116 110
} else {
117
	$pconfig['mac'] = $_GET['mac'];
118
	$pconfig['cid'] = $_GET['cid'];
119
	$pconfig['hostname'] = $_GET['hostname'];
120
	$pconfig['filename'] = $_GET['filename'];
121
	$pconfig['rootpath'] = $_GET['rootpath'];
122
	$pconfig['descr'] = $_GET['descr'];
123
	$pconfig['arp_table_static_entry'] = $_GET['arp_table_static_entry'];
124
	$pconfig['deftime'] = $_GET['defaultleasetime'];
125
	$pconfig['maxtime'] = $_GET['maxleasetime'];
126
	$pconfig['gateway'] = $_GET['gateway'];
127
	$pconfig['domain'] = $_GET['domain'];
128
	$pconfig['domainsearchlist'] = $_GET['domainsearchlist'];
129
	$pconfig['wins1'] = $_GET['wins1'];
130
	$pconfig['wins2'] = $_GET['wins2'];
131
	$pconfig['dns1'] = $_GET['dns1'];
132
	$pconfig['dns2'] = $_GET['dns2'];
133
	$pconfig['dns3'] = $_GET['dns3'];
134
	$pconfig['dns4'] = $_GET['dns4'];
135
	$pconfig['ddnsdomain'] = $_GET['ddnsdomain'];
136
	$pconfig['ddnsdomainprimary'] = $_GET['ddnsdomainprimary'];
137
	$pconfig['ddnsdomainkeyname'] = $_GET['ddnsdomainkeyname'];
138
	$pconfig['ddnsdomainkey'] = $_GET['ddnsdomainkey'];
139
	$pconfig['ddnsupdate'] = isset($_GET['ddnsupdate']);
140
	$pconfig['ddnsforcehostname'] = isset($_GET['ddnsforcehostname']);
141
	$pconfig['ntp1'] = $_GET['ntp1'];
142
	$pconfig['ntp2'] = $_GET['ntp2'];
143
	$pconfig['tftp'] = $_GET['tftp'];
111
	$pconfig['mac'] = $_REQUEST['mac'];
112
	$pconfig['cid'] = $_REQUEST['cid'];
113
	$pconfig['hostname'] = $_REQUEST['hostname'];
114
	$pconfig['filename'] = $_REQUEST['filename'];
115
	$pconfig['rootpath'] = $_REQUEST['rootpath'];
116
	$pconfig['descr'] = $_REQUEST['descr'];
117
	$pconfig['arp_table_static_entry'] = $_REQUEST['arp_table_static_entry'];
118
	$pconfig['deftime'] = $_REQUEST['defaultleasetime'];
119
	$pconfig['maxtime'] = $_REQUEST['maxleasetime'];
120
	$pconfig['gateway'] = $_REQUEST['gateway'];
121
	$pconfig['domain'] = $_REQUEST['domain'];
122
	$pconfig['domainsearchlist'] = $_REQUEST['domainsearchlist'];
123
	$pconfig['wins1'] = $_REQUEST['wins1'];
124
	$pconfig['wins2'] = $_REQUEST['wins2'];
125
	$pconfig['dns1'] = $_REQUEST['dns1'];
126
	$pconfig['dns2'] = $_REQUEST['dns2'];
127
	$pconfig['dns3'] = $_REQUEST['dns3'];
128
	$pconfig['dns4'] = $_REQUEST['dns4'];
129
	$pconfig['ddnsdomain'] = $_REQUEST['ddnsdomain'];
130
	$pconfig['ddnsdomainprimary'] = $_REQUEST['ddnsdomainprimary'];
131
	$pconfig['ddnsdomainkeyname'] = $_REQUEST['ddnsdomainkeyname'];
132
	$pconfig['ddnsdomainkey'] = $_REQUEST['ddnsdomainkey'];
133
	$pconfig['ddnsupdate'] = isset($_REQUEST['ddnsupdate']);
134
	$pconfig['ddnsforcehostname'] = isset($_REQUEST['ddnsforcehostname']);
135
	$pconfig['ntp1'] = $_REQUEST['ntp1'];
136
	$pconfig['ntp2'] = $_REQUEST['ntp2'];
137
	$pconfig['tftp'] = $_REQUEST['tftp'];
144 138
}
145 139

  
146
if ($_POST) {
140
if ($_POST['save']) {
147 141
	unset($input_errors);
148 142
	$pconfig = $_POST;
149 143

  
src/usr/local/www/services_dhcpv6.php
75 75
	exit;
76 76
}
77 77

  
78
$if = $_GET['if'];
79
if ($_POST['if']) {
80
	$if = $_POST['if'];
81
}
78
$if = $_REQUEST['if'];
82 79

  
83 80
/* if OLSRD is enabled, allow WAN to house DHCP. */
84 81
if ($config['installedpackages']['olsrd']) {
......
465 462
	}
466 463
}
467 464

  
468
if ($_GET['act'] == "del") {
469
	if ($a_maps[$_GET['id']]) {
470
		unset($a_maps[$_GET['id']]);
465
if ($_POST['act'] == "del") {
466
	if ($a_maps[$_POST['id']]) {
467
		unset($a_maps[$_POST['id']]);
471 468
		write_config();
472 469
		if (isset($config['dhcpdv6'][$if]['enable'])) {
473 470
			mark_subsystem_dirty('staticmapsv6');
......
1033 1030
					</td>
1034 1031
					<td>
1035 1032
						<a class="fa fa-pencil"	title="<?=gettext('Edit static mapping')?>" href="services_dhcpv6_edit.php?if=<?=$if?>&amp;id=<?=$i?>"></a>
1036
						<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&amp;act=del&amp;id=<?=$i?>"></a>
1033
						<a class="fa fa-trash"	title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&amp;act=del&amp;id=<?=$i?>" usepost></a>
1037 1034
					</td>
1038 1035
				</tr>
1039 1036
<?php
src/usr/local/www/services_dhcpv6_edit.php
50 50

  
51 51
require_once("guiconfig.inc");
52 52

  
53
$if = $_GET['if'];
54
if ($_POST['if']) {
55
	$if = $_POST['if'];
56
}
53
$if = $_REQUEST['if'];
57 54

  
58 55
if (!$if) {
59 56
	header("Location: services_dhcpv6.php");
......
76 73
$ifcfgsnv6 = get_interface_subnetv6($if);
77 74
$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
78 75

  
79
if (is_numericint($_GET['id'])) {
80
	$id = $_GET['id'];
81
}
82
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
83
	$id = $_POST['id'];
84
}
76
$id = $_REQUEST['id'];
85 77

  
86 78
if (isset($id) && $a_maps[$id]) {
87 79
	$pconfig['duid'] = $a_maps[$id]['duid'];
......
91 83
	$pconfig['rootpath'] = $a_maps[$id]['rootpath'];
92 84
	$pconfig['descr'] = $a_maps[$id]['descr'];
93 85
} else {
94
	$pconfig['duid'] = $_GET['duid'];
95
	$pconfig['hostname'] = $_GET['hostname'];
96
	$pconfig['filename'] = $_GET['filename'];
86
	$pconfig['duid'] = $_REQUEST['duid'];
87
	$pconfig['hostname'] = $_REQUEST['hostname'];
88
	$pconfig['filename'] = $_REQUEST['filename'];
97 89
	$pconfig['rootpath'] = $a_maps[$id]['rootpath'];
98
	$pconfig['descr'] = $_GET['descr'];
90
	$pconfig['descr'] = $_REQUEST['descr'];
99 91
}
100 92

  
101
if ($_POST) {
93
if ($_POST['save']) {
102 94

  
103 95
	unset($input_errors);
104 96
	$pconfig = $_POST;
......
122 114
			}
123 115
		}
124 116
	}
117

  
125 118
	if ($_POST['ipaddrv6']) {
126 119
		if (!is_ipaddrv6($_POST['ipaddrv6'])) {
127 120
			$input_errors[] = gettext("A valid IPv6 address must be specified.");

Also available in: Unified diff