Project

General

Profile

« Previous | Next » 

Revision 9d3e8723

Added by Phil Davis almost 9 years ago

Code style and comments

No functional change - just making style consistent

View differences:

src/etc/inc/filter_log.inc
223 223
	if (!( (trim($flent['time']) == "") && (trim($flent['action']) == "") && (trim($flent['user']) == "") && (trim($flent['ip_address']) == "") )) {
224 224
		return $flent;
225 225
	} else {
226
		if($g['debug']) {
226
		if ($g['debug']) {
227 227
			log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $line));
228 228
		}
229 229
		return "";
......
245 245
	if (!( (trim($flent['time']) == "") && (trim($flent['type']) == "") && (trim($flent['message']) == "") )) {
246 246
		return $flent;
247 247
	} else {
248
		if($g['debug']) {
248
		if ($g['debug']) {
249 249
			log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $line));
250 250
		}
251 251
		return "";
src/etc/inc/pfsense-utils.inc
707 707
function get_dir($dir) {
708 708
	$dir_array = array();
709 709
	$d = dir($dir);
710
	if(!is_object($d)) {
710
	if (!is_object($d)) {
711 711
		return array();
712 712
	}
713 713
	while (false !== ($entry = $d->read())) {
src/etc/inc/upgrade_config.inc
4437 4437
	if (is_array($config['filter']['separator'])) {
4438 4438
		foreach ($config['filter']['separator'] as $interface => $separators) {
4439 4439

  
4440
			if(is_array($separators)) {
4440
			if (is_array($separators)) {
4441 4441
				foreach ($separators as $sepn => $separator) {
4442 4442

  
4443 4443
					$seprow = substr($separator['row']['0'], 2);
src/etc/inc/util.inc
872 872
	$subnetv4_start1 = gen_subnetv4($subnet1, $largest_sn);
873 873
	$subnetv4_start2 = gen_subnetv4($subnet2, $largest_sn);
874 874
	
875
	if($subnetv4_start1 == '' || $subnetv4_start2 == '') {
875
	if ($subnetv4_start1 == '' || $subnetv4_start2 == '') {
876 876
		// One or both args is not a valid IPv4 subnet
877 877
		//FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
878 878
		return false;
......
887 887
	$subnetv6_start1 = gen_subnetv6($subnet1, $largest_sn);
888 888
	$subnetv6_start2 = gen_subnetv6($subnet2, $largest_sn);
889 889
	
890
	if($subnetv6_start1 == '' || $subnetv6_start2 == '') {
890
	if ($subnetv6_start1 == '' || $subnetv6_start2 == '') {
891 891
		// One or both args is not a valid IPv6 subnet
892 892
		//FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
893 893
		return false;
src/usr/local/www/classes/Form/Button.class.php
39 39
			$this->_tagName = 'a';
40 40
			$this->addClass('btn-default');
41 41
			unset($this->_attributes['type']);
42
			if(isset($icon)) {
42
			if (isset($icon)) {
43 43
				$this->_attributes['icon'] = $icon;
44 44
			}
45 45
		}
46
		else if(isset($icon))
46
		else if (isset($icon))
47 47
		{
48 48
			$this->_tagSelfClosing = false;
49 49
			$this->_tagName = 'button';
src/usr/local/www/classes/Form/Group.class.php
64 64

  
65 65
	public function enableDuplication($max = null, $horiz = false)
66 66
	{
67
		if($horiz)
67
		if ($horiz)
68 68
			$this->addClass('user-duplication-horiz');	// added buttons are 2 cols wide with no offset
69 69
		else
70 70
			$this->addClass('user-duplication');		// added buttons 10 cols wide with 2 col offset
src/usr/local/www/classes/Form/Input.class.php
209 209
	// These methods required by pkg_edit and the wizards that map xml element definitions to Form elements
210 210
	public function setOnclick($text)
211 211
	{
212
		if($text)
212
		if ($text)
213 213
			$this->_attributes['onclick'] = $text;
214 214

  
215 215
		return $this;
......
217 217

  
218 218
	public function setOnchange($text)
219 219
	{
220
		if($text)
220
		if ($text)
221 221
			$this->_attributes['onchange'] = $text;
222 222

  
223 223
		return $this;
src/usr/local/www/classes/Form/Section.class.php
62 62
	}
63 63

  
64 64
	// Shortcut, adds a group with a password and a confirm password field.
65
	// The confirm password element is created by apprnding "_confirm" to the name supplied
65
	// The confirm password element is created by appending "_confirm" to the name supplied
66 66
	// The value is overwritten with a default pattern (So the user cannot see it)
67 67
	public function addPassword(Form_Input $input)
68 68
	{
69 69
		$group = new Form_Group($input->getTitle());
70
		if($input->getValue() != "") {
70
		if ($input->getValue() != "") {
71 71
			$input->setValue(DMYPWD);
72 72
		}
73 73

  
src/usr/local/www/classes/Form/Select.class.php
47 47
		$options = '';
48 48
		foreach ($this->_values as $value => $name)
49 49
		{
50
			// Things can get wierd if we have mixed types
50
			// Things can get weird if we have mixed types
51 51
			$sval = $this->_value;
52 52

  
53
			if( (gettype($value) == "integer") && (gettype($sval) == "string") )
53
			if ((gettype($value) == "integer") && (gettype($sval) == "string"))
54 54
				$value = strval($value);
55 55

  
56
			if (isset($this->_attributes['multiple']))
56
			if (isset($this->_attributes['multiple'])) {
57 57
				$selected = in_array($value, (array)$sval);
58
			else {
58
			} else {
59 59
				$selected = ($sval == $value);
60 60
			}
61 61

  
src/usr/local/www/diag_dns.php
55 55
	$resolved = array();
56 56
	$errreporting = error_reporting();
57 57
	error_reporting($errreporting & ~E_WARNING);// dns_get_record throws a warning if nothing is resolved..
58
	foreach($recordtypes as $recordtype) {
58
	foreach ($recordtypes as $recordtype) {
59 59
		$tmp = dns_get_record($host, $recordtype);
60 60
		if (is_array($tmp)) {
61 61
			$dnsresult = array_merge($dnsresult, $tmp);
......
63 63
	}
64 64
	error_reporting($errreporting);// restore original php warning/error settings.
65 65
	
66
	foreach($dnsresult as $item) {
66
	foreach ($dnsresult as $item) {
67 67
		$newitem = array();
68 68
		$newitem['type'] = $item['type'];
69 69
		switch ($item['type']) {
src/usr/local/www/diag_edit.php
156 156

  
157 157
			// calculate start/end
158 158
			var startPos = 0, endPos = tarea.value.length;
159
			for(var x = 0; x < lines.length; x++) {
160
				if(x == lineNum) {
159
			for (var x = 0; x < lines.length; x++) {
160
				if (x == lineNum) {
161 161
					break;
162 162
				}
163 163
				startPos += (lines[x].length+1);
......
169 169
			// do selection
170 170
			// Chrome / Firefox
171 171

  
172
			if(typeof(tarea.selectionStart) != "undefined") {
172
			if (typeof(tarea.selectionStart) != "undefined") {
173 173
				tarea.focus();
174 174
				tarea.selectionStart = startPos;
175 175
				tarea.selectionEnd = endPos;
src/usr/local/www/firewall_virtual_ip_edit.php
433 433
	$pconfig['descr']
434 434
))->setHelp('A description may be entered here for administrative reference (not parsed).');
435 435

  
436
if (isset($id) && $a_vip[$id]){
436
if (isset($id) && $a_vip[$id]) {
437 437
	$section->addInput(new Form_Input(
438 438
		'id',
439 439
		null,
src/usr/local/www/js/pfSense.js
143 143
	// Use element title in the confirmation message, or if not available
144 144
	// the element value
145 145
	$('.btn-danger, .fa-trash').on('click', function(e){
146
		if(!($(this).hasClass('no-confirm'))) {
146
		if (!($(this).hasClass('no-confirm'))) {
147 147
			var msg = $.trim(this.textContent);
148 148

  
149
			if(!msg)
149
			if (!msg)
150 150
				var msg = $.trim(this.value).toLowerCase();
151 151

  
152 152
			var q = 'Are you sure you wish to '+ msg +'?';
......
201 201

  
202 202
	  originalLeave.call(this, obj);
203 203

  
204
	  if(self.$tip && self.$tip.length) {
204
	  if (self.$tip && self.$tip.length) {
205 205
	    container = self.$tip;
206 206
	    timeout = self.timeout;
207 207
	    container.one('mouseenter', function(){
src/usr/local/www/js/pfSenseHelpers.js
109 109

  
110 110
// Hides the '/' and the subnet mask of an Ip_Address/subnet_mask group
111 111
function hideMask(name, hide) {
112
	if(hide) {
112
	if (hide) {
113 113
		$('[id^=' + name + ']').hide();
114 114
		$('[id^=' + name + ']').prev('span').hide();
115 115
		$('[id^=' + name + ']').parent('div').removeClass('input-group');
src/usr/local/www/pkg_mgr_install.php
568 568

  
569 569
		json = jQuery.parseJSON(response);
570 570

  
571
		if(json) {
571
		if (json) {
572 572
			$('#installed_version').text(json.installed_version);
573 573
			$('#version').text(json.version);
574 574

  
src/usr/local/www/services_dhcpv6_edit.php
243 243
	$pconfig['descr']
244 244
))->setHelp('A description may be entered here for administrative reference (not parsed).');
245 245

  
246
if($netboot_enabled) {
246
if ($netboot_enabled) {
247 247
	$section->addInput(new Form_Input(
248 248
		'filename',
249 249
		'Netboot filename',
src/usr/local/www/services_router_advertisements.php
316 316

  
317 317
$carplistif = array();
318 318

  
319
if(count($carplist) > 0) {
320
	foreach($carplist as $ifname => $vip) {
319
if (count($carplist) > 0) {
320
	foreach ($carplist as $ifname => $vip) {
321 321
		if (get_configured_vip_interface($ifname) == $if) {
322 322
			$carplistif[$ifname] = $vip;
323 323
		}
......
328 328
	$iflist = array();
329 329

  
330 330
	$iflist['interface'] = strtoupper($if);
331
	foreach($carplistif as $ifname => $vip) {
331
	foreach ($carplistif as $ifname => $vip) {
332 332
		$iflist[$ifname] = get_vip_descr($vip) . " - " . $vip;
333 333
	}
334 334

  
src/usr/local/www/status_logs_filter_dynamic.php
294 294
		move = 0;
295 295
	}
296 296

  
297
	if (($("#count").text() == 0) && (data.length < nentries)){
297
	if (($("#count").text() == 0) && (data.length < nentries)) {
298 298
		move += rows.length;
299 299
	}
300 300

  
......
445 445
						<td><?=htmlspecialchars($filterent['proto'])?></td>
446 446
					</tr>
447 447
<?php
448
				} // e-o-foreach()
448
				} // e-o-foreach ()
449 449

  
450 450
	if (count($filterlog) == 0) {
451 451
		print '<tr class="text-nowrap"><td colspan=6>';
src/usr/local/www/system_advanced_misc.php
115 115
		$input_errors[] = gettext("The proxy username contains invalid characters.");
116 116
	}
117 117

  
118
	if($_POST['proxypass'] != $_POST['proxypass_confirm']) {
118
	if ($_POST['proxypass'] != $_POST['proxypass_confirm']) {
119 119
		$input_errors[] = gettext("Proxy password and confirmation must match.");
120 120
	}
121 121

  
src/usr/local/www/system_authservers.php
394 394
}
395 395

  
396 396
// On error, restore the form contents so the user doesn't have to re-enter too much
397
if($_POST && $input_errors) {
397
if ($_POST && $input_errors) {
398 398
	$pconfig = $_POST;
399 399
	$pconfig['ldap_authcn'] = $_POST['ldapauthcontainers'];
400 400
	$pconfig['ldap_template'] = $_POST['ldap_tmpltype'];
......
439 439
					</tr>
440 440
				</thead>
441 441
				<tbody>
442
			<?php foreach($a_server as $i => $server): ?>
442
			<?php foreach ($a_server as $i => $server): ?>
443 443
					<tr>
444 444
						<td><?=htmlspecialchars($server['name'])?></td>
445 445
						<td><?=htmlspecialchars($auth_server_types[$server['type']])?></td>
......
651 651
if (!isset($id)) {
652 652
	$template_list = array();
653 653

  
654
	foreach($ldap_templates as $option => $template) {
654
	foreach ($ldap_templates as $option => $template) {
655 655
		$template_list[$option] = $template['desc'];
656 656
	}
657 657

  
......
880 880
	}
881 881

  
882 882
	function set_ldap_port() {
883
		if($('#ldap_urltype').find(":selected").index() == 0)
883
		if ($('#ldap_urltype').find(":selected").index() == 0)
884 884
			$('#ldap_port').val('389');
885 885
		else
886 886
			$('#ldap_port').val('636');
......
888 888

  
889 889
	// Hides all elements of the specified class. This will usually be a section
890 890
	function hideClass(s_class, hide) {
891
		if(hide)
891
		if (hide)
892 892
			$('.' + s_class).hide();
893 893
		else
894 894
			$('.' + s_class).show();
......
921 921
	hideClass('ldapanon', $('#ldap_anon').prop('checked'));
922 922
	hideClass('extended', !$('#ldap_extended_enabled').prop('checked'));
923 923

  
924
	if($('#ldap_port').val() == "")
924
	if ($('#ldap_port').val() == "")
925 925
		set_ldap_port();
926 926

  
927 927
<?php
928
	if($act == 'edit') {
928
	if ($act == 'edit') {
929 929
?>
930 930
		$('#type option:not(:selected)').each(function(){
931 931
			$(this).attr('disabled', 'disabled');
932 932
		});
933 933

  
934 934
<?php
935
		if(!$input_errors) {
935
		if (!$input_errors) {
936 936
?>
937 937
		$('#name').prop("readonly", true);
938 938
<?php
src/usr/local/www/system_crlmanager.php
315 315

  
316 316
	$list = array();
317 317

  
318
	foreach($ca_certs as $cert) {
318
	foreach ($ca_certs as $cert) {
319 319
		$list[$cert['refid']] = $cert['descr'];
320 320
	}
321 321

  
src/usr/local/www/system_gateway_groups_edit.php
339 339
	$pconfig['descr']
340 340
))->setHelp('A description may be entered here for administrative reference (not parsed).');
341 341

  
342
if (isset($id) && $a_gateway_groups[$id]){
342
if (isset($id) && $a_gateway_groups[$id]) {
343 343
	$section->addInput(new Form_Input(
344 344
	'id',
345 345
	null,
src/usr/local/www/system_groupmanager.php
160 160
	}
161 161

  
162 162
	/* Check the POSTed members to ensure they are valid and exist */
163
	if(is_array($_POST['members'])) {
163
	if (is_array($_POST['members'])) {
164 164
		foreach ($_POST['members'] as $newmember) {
165 165
			if (!is_numeric($newmember) || empty(getUserEntryByUID($newmember))) {
166 166
				$input_errors[] = gettext("One or more invalid group members was submitted.");
......
353 353
	$id
354 354
));
355 355

  
356
if (isset($id) && $a_group[$id]){
356
if (isset($id) && $a_group[$id]) {
357 357
	$form->addGlobal(new Form_Input(
358 358
		'id',
359 359
		null,
src/usr/local/www/system_groupmanager_addprivs.php
268 268
	});
269 269

  
270 270
	$('#filtertxt').keypress(function(e) {
271
		if(e.which == 13) {
271
		if (e.which == 13) {
272 272
			e.preventDefault();
273 273
			$('#btnfilter').trigger('click');
274 274
		}
src/usr/local/www/system_update_settings.php
154 154
		'synconupgrade',
155 155
		'Auto sync on update',
156 156
		'Enable repository/branch sync before reboot',
157
		'Enable repository/branch sync before reboot',
157 158
		isset($gitcfg['synconupgrade'])
158 159
		))->setHelp('After updating, sync with the following repository/branch before reboot.');
159 160

  
......
195 196
					'<br />Note: Sync will not be performed if a branch is not specified.', [$lastbranch]);
196 197

  
197 198
	$form->add($section);
198
} // e-o-if(file_exista()
199
} // e-o-if (file_exists())
199 200

  
200 201
print($form);
201 202

  
src/usr/local/www/system_usermanager.php
215 215
	}
216 216

  
217 217
	/* Check the POSTed groups to ensure they are valid and exist */
218
	if(is_array($_POST['groups'])) {
218
	if (is_array($_POST['groups'])) {
219 219
		foreach ($_POST['groups'] as $newgroup) {
220 220
			if (empty(getGroupEntry($newgroup))) {
221 221
				$input_errors[] = gettext("One or more invalid groups was submitted.");
......
852 852
		$section->addClass('cert-options');
853 853

  
854 854
		$nonPrvCas = array();
855
		foreach($config['ca'] as $ca) {
855
		foreach ($config['ca'] as $ca) {
856 856
			if (!$ca['prv']) {
857 857
				continue;
858 858
			}
src/usr/local/www/system_usermanager_addprivs.php
272 272
	});
273 273

  
274 274
	$('#filtertxt').keypress(function(e) {
275
		if(e.which == 13) {
275
		if (e.which == 13) {
276 276
			e.preventDefault();
277 277
			$('#btnfilter').trigger('click');
278 278
		}
src/usr/local/www/vpn_openvpn_server.php
1227 1227
events.push(function() {
1228 1228

  
1229 1229
	function advanced_change(hide, mode) {
1230
		if(!hide) {
1230
		if (!hide) {
1231 1231
			hideClass('advanced', false);
1232 1232
			hideClass("clientadv", false);
1233 1233
		} else if (mode == "p2p_tls") {
src/usr/local/www/widgets/javascript/thermal_sensors.js
24 24

  
25 25
//should be called from "thermal_sensors.widget.php"
26 26
function showThermalSensorsData() {
27
	if(!ajaxBusy) {
27
	if (!ajaxBusy) {
28 28
		ajaxBusy = true;
29 29
		//get data from thermal_sensors.widget.php
30 30
		url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1"
......
54 54
	if (thermal_sensors_widget_showRawOutput) {
55 55
		buildThermalSensorsDataRaw(thermalSensorsData);
56 56
	} else {
57
		if(warningTemp == 9999) {
57
		if (warningTemp == 9999) {
58 58
			buildThermalSensorsDataGraph(thermalSensorsData);
59 59
		}
60 60

  
......
192 192
function setTempProgress(bar, percent) {
193 193
	var barTempL, barTempM, barTempH;
194 194

  
195
	if(percent <= warningTemp) {
195
	if (percent <= warningTemp) {
196 196
		barTempL = percent;
197 197
		barTempM = 0;
198 198
		barTempH = 0;
199
	} else if(percent <= criticalTemp) {
199
	} else if (percent <= criticalTemp) {
200 200
		barTempL = warningTemp;
201 201
		barTempM = percent - warningTemp;
202 202
		barTempH = 0;
src/usr/local/www/widgets/widgets/gmirror_status.widget.php
35 35

  
36 36
<script type="text/javascript">
37 37
//<![CDATA[
38
function gmirrorStatusUpdateFromServer(){
38
function gmirrorStatusUpdateFromServer() {
39 39
	$.ajax({
40 40
		type: 'get',
41 41
		url: '/widgets/widgets/gmirror_status.widget.php',
src/usr/local/www/widgets/widgets/log.widget.php
175 175

  
176 176
<script type="text/javascript">
177 177
//<![CDATA[
178
function logWidgetUpdateFromServer(){
178
function logWidgetUpdateFromServer() {
179 179
	$.ajax({
180 180
		type: 'get',
181 181
		url: '/widgets/widgets/log.widget.php',
src/usr/local/www/widgets/widgets/ntp_status.widget.php
191 191
?>
192 192
<script type="text/javascript">
193 193
//<![CDATA[
194
function ntpWidgetUpdateFromServer(){
194
function ntpWidgetUpdateFromServer() {
195 195
	$.ajax({
196 196
		type: 'get',
197 197
		url: '/widgets/widgets/ntp_status.widget.php',
......
207 207
	});
208 208
}
209 209

  
210
function ntpWidgetUpdateDisplay(){
210
function ntpWidgetUpdateDisplay() {
211 211
	// Javascript handles overflowing
212 212
	ntpServerTime.setSeconds(ntpServerTime.getSeconds()+1);
213 213

  
src/usr/local/www/widgets/widgets/system_information.widget.php
166 166
				<ul style="margin-bottom:0px">
167 167
				<?php
168 168
					$dns_servers = get_dns_servers();
169
					foreach($dns_servers as $dns) {
169
					foreach ($dns_servers as $dns) {
170 170
						echo "<li>{$dns}</li>";
171 171
					}
172 172
				?>
......
338 338

  
339 339
function stats(x) {
340 340
	var values = x.split("|");
341
	if ($.each(values,function(key,value){
341
	if ($.each(values,function(key,value) {
342 342
		if (value == 'undefined' || value == null)
343 343
			return true;
344 344
		else
......
470 470
			} else {
471 471
				ipv4_details = details[2] + '<br />';
472 472
			}
473
			switch(details[1]) {
473
			switch (details[1]) {
474 474
				case "up":
475 475
					$('#' + details[0] + '-up').css("display","inline");
476 476
					$('#' + details[0] + '-down').css("display","none");
src/usr/local/www/wizard.php
851 851

  
852 852
				break;
853 853
		} // e-o-switch
854
	} // e-o-foreach(package)
855
} // e-o- if(we have fields)
854
	} // e-o-foreach (package)
855
} // e-o-if (we have fields)
856 856

  
857 857
$form->add($section);
858 858
print($form);
src/usr/local/www/wizards/openvpn_wizard.inc
184 184
	$canames = array();
185 185
	$cacns = array();
186 186
	if (is_array($config['ca'])) {
187
		foreach($config['ca'] as $ca) {
187
		foreach ($config['ca'] as $ca) {
188 188
			$canames[] = $ca['descr'];
189 189
			$cainfo = cert_get_subject_hash($ca['crt']);
190 190
			$cacns[] = $cainfo["CN"];
......
287 287
	$certnames = array();
288 288
	$certcns = array();
289 289
	if (is_array($config['cert'])) {
290
		foreach($config['cert'] as $cert) {
290
		foreach ($config['cert'] as $cert) {
291 291
			$certnames[] = $cert['descr'];
292 292
			$certinfo = cert_get_subject_hash($cert['crt']);
293 293
			$certcns[] = $certinfo["CN"];
src/usr/local/www/wizards/setup_wizard.xml
116 116
	</stepbeforeformdisplay>
117 117
	<stepsubmitphpaction>
118 118
		<![CDATA[
119
		if(empty($_POST['hostname']) || !is_unqualified_hostname($_POST['hostname'])) {
119
		if (empty($_POST['hostname']) || !is_unqualified_hostname($_POST['hostname'])) {
120 120
			include("head.inc");
121 121
			$input_errors[] = "Hostname is invalid. Please press back in the browser window and correct.";
122 122
			print_input_errors($input_errors);
123 123
			include("foot.inc");
124 124
			die;
125 125
		}
126
		if(empty($_POST['domain']) || !is_domain($_POST['domain'])) {
126
		if (empty($_POST['domain']) || !is_domain($_POST['domain'])) {
127 127
			include("head.inc");
128 128
			$input_errors[] = "Domain is invalid. Please press back in the browser window and correct.";
129 129
			print_input_errors($input_errors);
130 130
			include("foot.inc");
131 131
			die;
132 132
		}
133
		if(!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) {
133
		if (!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) {
134 134
			include("head.inc");
135 135
			$input_errors[] = "Primary DNS server is invalid. Please press back in the browser window and correct.";
136 136
			print_input_errors($input_errors);
137 137
			include("foot.inc");
138 138
			die;
139 139
		}
140
		if(!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) {
140
		if (!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) {
141 141
			include("head.inc");
142 142
			$input_errors[] = "Second DNS server is invalid. Please press back in the browser window and correct.";
143 143
			print_input_errors($input_errors);
......
188 188
	<description>On this screen the Wide Area Network information will be configured.</description>
189 189
	<javascriptafterformdisplay>
190 190
		var selectedItem = 0;
191
		if(document.forms[0].ipaddress.value == 'dhcp') {
191
		if (document.forms[0].ipaddress.value == 'dhcp') {
192 192
			selectedItem = 1;
193 193
			document.forms[0].ipaddress.value = '';
194
		} else if(document.forms[0].ipaddress.value == 'pppoe') {
194
		} else if (document.forms[0].ipaddress.value == 'pppoe') {
195 195
			selectedItem = 2;
196 196
			document.forms[0].ipaddress.value = '';
197
		} else if(document.forms[0].ipaddress.value == 'pptp') {
197
		} else if (document.forms[0].ipaddress.value == 'pptp') {
198 198
			selectedItem = 3;
199 199
			document.forms[0].ipaddress.value = '';
200
		} else if(document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') {
200
		} else if (document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') {
201 201
			document.forms[0].ipaddress.value = '';
202 202
		} else {
203 203
			selectedItem = 0;
......
207 207

  
208 208
		events.push(function(){
209 209
			$('#showpppoepassword').click(function(event) {
210
				if(this.checked) {
210
				if (this.checked) {
211 211
					$('#pppoepassword').attr('type', 'text');
212 212
				} else {
213 213
					$('#pppoepassword').attr('type', 'password');
......
215 215
			});
216 216

  
217 217
			$('#showpptppassword').click(function(event) {
218
				if(this.checked) {
218
				if (this.checked) {
219 219
					$('#pptppassword').attr('type', 'text');
220 220
				} else {
221 221
					$('#pptppassword').attr('type', 'password');
......
456 456
	</stepbeforeformdisplay>
457 457
	<stepsubmitphpaction>
458 458
		<![CDATA[
459
		if(!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) {
459
		if (!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) {
460 460
			include("head.inc");
461 461
			$input_errors[] = "MTU Must be at least 576 (Per RFC 791). Please press back in the browser window and correct.";
462 462
			print_input_errors($input_errors);
463 463
			include("foot.inc");
464 464
			die;
465 465
		}
466
		if(!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) {
466
		if (!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) {
467 467
			include("head.inc");
468 468
			$input_errors[] = "Invalid MAC Address. Please press back in the browser window and correct.";
469 469
			print_input_errors($input_errors);
470 470
			include("foot.inc");
471 471
			die;
472 472
		}
473
		if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) {
473
		if (!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) {
474 474
			if (!is_ipaddr($_POST['ipaddress'])) {
475 475
				include("head.inc");
476 476
				$input_errors[] = "Invalid WAN IP Address. Please press back in the browser window and correct.";
......
488 488
				die;
489 489
			}
490 490
		}
491
		if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) {
491
		if (!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) {
492 492
			include("head.inc");
493 493
			$input_errors[] = "Invalid DHCP Hostname. Please press back in the browser window and correct.";
494 494
			print_input_errors($input_errors);
495 495
			include("foot.inc");
496 496
			die;
497 497
		}
498
		if(!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) {
498
		if (!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) {
499 499
		    include("head.inc");
500 500
			$input_errors[] = "Invalid PPTP Local IP Address. Please press back in the browser window and correct.";
501 501
			print_input_errors($input_errors);
502 502
			include("foot.inc");
503 503
			die;
504 504
		}
505
		if(!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) {
505
		if (!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) {
506 506
			include("head.inc");
507 507
			$input_errors[] = "Invalid PPTP Remote IP Address. Please press back in the browser window and correct.";
508 508
			print_input_errors($input_errors);
......
552 552
	</stepsubmitphpaction>
553 553
	<stepsubmitbeforesave>
554 554
		<![CDATA[
555
			if($_POST['selectedtype'] == "Static") {
555
			if ($_POST['selectedtype'] == "Static") {
556 556

  
557 557
			} else {
558 558
				$_POST['ipaddress'] = $_POST['selectedtype'];
559 559
				$config['interfaces']['wan']['ipaddr'] = $_POST['selectedtype'];
560 560
				write_config();
561 561
			}
562
			if(!$config['interfaces']['lan']) {
562
			if (!$config['interfaces']['lan']) {
563 563
				header("Location: /wizard.php?xml=setup_wizard.xml&stepid=6&next=Next");
564 564
			}
565 565
		]]>
......
590 590
	</fields>
591 591
	<stepsubmitphpaction>
592 592
		<![CDATA[
593
		if(empty($_POST['lanipaddress']) || !is_ipaddr($_POST['lanipaddress'])) {
593
		if (empty($_POST['lanipaddress']) || !is_ipaddr($_POST['lanipaddress'])) {
594 594
			print_info_box("Invalid LAN IP address. Please press back in the browser window and correct.");
595 595
			die;
596 596
		}
......
672 672
	</fields>
673 673
	<stepsubmitphpaction>
674 674
	<![CDATA[
675
	if($_POST['adminpassword'] != "") {
676
		if($_POST['adminpassword'] == $_POST['adminpasswordagain']) {
675
	if ($_POST['adminpassword'] != "") {
676
		if ($_POST['adminpassword'] == $_POST['adminpasswordagain']) {
677 677
			$admin_user =& getUserEntryByUID(0);
678 678
			local_user_set_password($admin_user, $_POST['adminpassword']);
679 679
			local_user_set($admin_user);
......
751 751
	<title>Wizard completed.</title>
752 752
	<stepbeforeformdisplay>
753 753
	<![CDATA[
754
		if($g['product_name'] <> 'pfSense') {
754
		if ($g['product_name'] <> 'pfSense') {
755 755
			header("Location: " . fixup_string("\$myurl"));
756 756
			exit;
757 757
		}
src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
475 475
	if (!$_POST['enable'])
476 476
		return;
477 477

  
478
	if($_POST['upstream_sip_server']) {
479
		if(!is_ipaddroralias($_POST['upstream_sip_server'])) {
478
	if ($_POST['upstream_sip_server']) {
479
		if (!is_ipaddroralias($_POST['upstream_sip_server'])) {
480 480
			/* item is not an ip or alias.  error out */
481 481
			$savemsg=gettext("Address must be a valid IP address or Firewall Alias.  Please correct this value to continue.");
482 482
			$stepid--;
......
558 558
	global $stepid, $savemsg;
559 559

  
560 560
	if ( $_POST['enable'] ) {
561
		if(!$_POST['bandwidth']) {
561
		if (!$_POST['bandwidth']) {
562 562
			$savemsg="A value for bandwidth must be specified.";
563 563
			$stepid--;
564 564
			return;
565 565
		}
566
		if(!is_numeric($_POST['bandwidth'])) {
566
		if (!is_numeric($_POST['bandwidth'])) {
567 567
			$savemsg="The posted value is not a valid bandwidth.";
568 568
			$stepid--;
569 569
			return;
......
575 575
			return;
576 576
		}
577 577
		$bw = $_POST['bandwidth'];
578
		if($bw > 15 || $bw < 2) {
578
		if ($bw > 15 || $bw < 2) {
579 579
			$savemsg="Values should be between 2% and 15%!";
580 580
			$stepid--;
581 581
			return;
582 582
		}
583
		if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
583
		if ($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
584 584
			/* item is not an ip or alias.  error out */
585 585
			$savemsg=gettext("Address must be a valid IP address or Firewall Alias.  Please correct this value to continue.");
586 586
			$stepid--;
......
593 593

  
594 594
	if ( $_POST['enable'] ) {
595 595
		if ($_POST['p2pcatchall']) {
596
			if(!is_numeric($_POST['bandwidth'])) {
596
			if (!is_numeric($_POST['bandwidth'])) {
597 597
				$savemsg="Posted value is not a valid bandwidth.";
598 598
				$stepid--;
599 599
				return;
......
604 604
				return;
605 605
			}
606 606
			$bw = $_POST['bandwidth'];
607
			if($bw > 15 || $bw < 2) {
607
			if ($bw > 15 || $bw < 2) {
608 608
				$savemsg="Values should be between 2% and 15%!";
609 609
				$stepid--;
610 610
				return;
......
645 645
	 * Doing it here makes sense since we can wipe the previous config only after
646 646
	 * the user decides to do so, finishing the wizard.
647 647
	 */
648
	if(isset($config['shaper']['queue']))
648
	if (isset($config['shaper']['queue']))
649 649
		unset($config['shaper']['queue']);
650 650
	/* XXX: This is redundant, because this should be handled by converter at startup. */
651
	if(isset($config['shaper']['rule']))
651
	if (isset($config['shaper']['rule']))
652 652
		unset($config['shaper']['rule']);
653 653
	foreach ($config['filter']['rule'] as $key => $rule)
654 654
		if ($rule['wizard'] == "yes")
......
1438 1438

  
1439 1439
	/* Rules */
1440 1440
	if ($penalty) {
1441
		if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
1441
		if ( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
1442 1442
			$rule = array();
1443 1443
			$rule['type'] = "match";
1444 1444
			$rule['interface'] = $interfacelist;
......
1456 1456

  
1457 1457
	/* If user specifies an IP, we don't bother with providers */
1458 1458
	if ($voip) {
1459
		if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
1459
		if (is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
1460 1460
			/* create VOIP rules */
1461 1461
			$rule = array();
1462 1462
			$rule['type'] = "match";
......
1486 1486
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1487 1487
			$config['filter']['rule'][] = $rule;
1488 1488

  
1489
		} elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) {
1489
		} elseif ( $config['ezshaper']['step3']['provider'] == "Generic" ) {
1490 1490
			/* create VOIP rules */
1491 1491
			$rule = array();
1492 1492
			$rule['type'] = "match";
......
1517 1517
				$rule['wizard'] = "yes";
1518 1518
				$rule['enabled'] = "on";
1519 1519
				$rule['destination']['port'] = $voip[2]."-".$voip[3];
1520
				if($voip[1] != '')
1520
				if ($voip[1] != '')
1521 1521
					$rule['protocol'] = $voip[1];
1522 1522
				$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1523 1523
				$config['filter']['rule'][] = $rule;
......
1527 1527

  
1528 1528
	/* loop through p2plist[] */
1529 1529
	if ($p2p) {
1530
		foreach($config['ezshaper']['step5'] as $key => $val) {
1530
		foreach ($config['ezshaper']['step5'] as $key => $val) {
1531 1531
			if (!is_array($p2plist[$key]))
1532 1532
				continue;
1533 1533
			foreach ($p2plist[$key] as $p2pclient) {
......
1541 1541
				$rule['floating'] = "yes";
1542 1542
				$rule['wizard'] = "yes";
1543 1543
				$rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
1544
				if($p2pclient[1] != '')
1544
				if ($p2pclient[1] != '')
1545 1545
					$rule['protocol'] = $p2pclient[1];
1546 1546
				$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1547 1547
				$config['filter']['rule'][] = $rule;
......
1551 1551

  
1552 1552
	/* loop through gamesplist[] */
1553 1553
	if ($games) {
1554
		foreach($config['ezshaper']['step6'] as $key => $val) {
1554
		foreach ($config['ezshaper']['step6'] as $key => $val) {
1555 1555
			if (!is_array($gamesplist[$key]))
1556 1556
				continue;
1557 1557
			foreach ($gamesplist[$key] as $Gameclient) {
......
1568 1568
				$rule['enabled'] = "on";
1569 1569
				$rule['descr'] = "m_Game {$Gameclient[0]} outbound";
1570 1570
				$rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
1571
				if($Gameclient[1] != '')
1571
				if ($Gameclient[1] != '')
1572 1572
					$rule['protocol'] = $Gameclient[1];
1573 1573
				$config['filter']['rule'][] = $rule;
1574 1574
			}
......
1577 1577

  
1578 1578
	/* loop through othersplist[] */
1579 1579
	if ($otherpriority) {
1580
		foreach($config['ezshaper']['step7'] as $key => $val) {
1580
		foreach ($config['ezshaper']['step7'] as $key => $val) {
1581 1581
			if (!is_array($othersplist[$key]))
1582 1582
				continue;
1583 1583
			foreach ($othersplist[$key] as $otherclient) {
......
1617 1617
					$rule['enabled'] = "on";
1618 1618
					$rule['descr'] = "m_Other {$otherclient[0]} outbound";
1619 1619

  
1620
					if($otherclient[2] or $otherclient[3]) {
1620
					if ($otherclient[2] or $otherclient[3]) {
1621 1621
						$rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
1622 1622
					}
1623
					if($otherclient[1] != '')
1623
					if ($otherclient[1] != '')
1624 1624
						$rule['protocol'] = $otherclient[1];
1625 1625
					$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1626 1626
					$config['filter']['rule'][] = $rule;
src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
529 529
	if (!$_POST['enable'])
530 530
		return;
531 531

  
532
	if($_POST['upstream_sip_server']) {
533
		if(!is_ipaddroralias($_POST['upstream_sip_server'])) {
532
	if ($_POST['upstream_sip_server']) {
533
		if (!is_ipaddroralias($_POST['upstream_sip_server'])) {
534 534
			/* item is not an ip or alias.  error out */
535 535
			$savemsg=gettext("Address must be a valid IP address or Firewall Alias.  Please correct this value to continue.");
536 536
			$stepid--;
......
626 626
	global $stepid, $savemsg;
627 627

  
628 628
	if ( $_POST['enable'] ) {
629
		if(!$_POST['bandwidth']) {
629
		if (!$_POST['bandwidth']) {
630 630
			$savemsg="A value for bandwidth must be specified.";
631 631

  
632 632
			$stepid--;
633 633
			return;
634 634
		}
635
		if(!is_numeric($_POST['bandwidth'])) {
635
		if (!is_numeric($_POST['bandwidth'])) {
636 636
			$savemsg="The posted value is not a valid bandwidth.";
637 637
			$stepid--;
638 638
			return;
......
643 643
			return;
644 644
		}
645 645
		$bw = $_POST['bandwidth'];
646
		if($bw > 15 || $bw < 2) {
646
		if ($bw > 15 || $bw < 2) {
647 647
			$savemsg="Values should be between 2% and 15%!";
648 648
			$stepid--;
649 649
			return;
650 650
		}
651
		if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
651
		if ($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
652 652
			/* item is not an ip or alias.  error out */
653 653
			$savemsg=gettext("Address must be a valid IP address or Firewall Alias.  Please correct this value to continue.");
654 654
			$stepid--;
......
660 660
	global $stepid, $savemsg;
661 661
	if ( $_POST['enable'] ) {
662 662
		if ($_POST['p2pcatchall']) {
663
			if(!is_numeric($_POST['bandwidth'])) {
663
			if (!is_numeric($_POST['bandwidth'])) {
664 664
				$savemsg="Posted value is not a valid bandwidth.";
665 665
				$stepid--;
666 666
			}
......
670 670
				return;
671 671
			}
672 672
			$bw = $_POST['bandwidth'];
673
			if($bw > 15 || $bw < 2) {
673
			if ($bw > 15 || $bw < 2) {
674 674
				$savemsg="Values should be between 2% and 15%!";
675 675
				$stepid--;
676 676
				return;
......
711 711
	 * Doing it here makes sense since we can wipe the previous config only after
712 712
	 * the user decides to do so, finishing the wizard.
713 713
	 */
714
	if(isset($config['shaper']['queue']))
714
	if (isset($config['shaper']['queue']))
715 715
		unset($config['shaper']['queue']);
716 716
	/* XXX: This is redundant, because this should be handled by converter at startup. */
717
	if(isset($config['shaper']['rule']))
717
	if (isset($config['shaper']['rule']))
718 718
		unset($config['shaper']['rule']);
719 719
	foreach ($config['filter']['rule'] as $key => $rule)
720 720
		if ($rule['wizard'] == "yes")
......
1526 1526

  
1527 1527
	/* Rules */
1528 1528
	if ($penalty) {
1529
		if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
1529
		if (is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
1530 1530
			$rule = array();
1531 1531
			$rule['type'] = "match";
1532 1532
			$rule['interface'] = $interfacelist;
......
1545 1545

  
1546 1546
			/* If user specifies an IP, we don't bother with providers */
1547 1547
			if ($voip) {
1548
				if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
1548
				if (is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
1549 1549
					/* create VOIP rules */
1550 1550
					$rule = array();
1551 1551
					$rule['type'] = "match";
......
1575 1575
					$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1576 1576
					$config['filter']['rule'][] = $rule;
1577 1577

  
1578
				} elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) {
1578
				} elseif ($config['ezshaper']['step3']['provider'] == "Generic") {
1579 1579
					/* create VOIP rules */
1580 1580
					$rule = array();
1581 1581
					$rule['type'] = "match";
......
1606 1606
						$rule['wizard'] = "yes";
1607 1607
						$rule['enabled'] = "on";
1608 1608
						$rule['destination']['port'] = $voip[2]."-".$voip[3];
1609
						if($voip[1] != '')
1609
						if ($voip[1] != '')
1610 1610
							$rule['protocol'] = $voip[1];
1611 1611
						$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1612 1612
						$config['filter']['rule'][] = $rule;
......
1616 1616

  
1617 1617
			/* loop through p2plist[] */
1618 1618
			if ($p2p) {
1619
				foreach($config['ezshaper']['step5'] as $key => $val) {
1619
				foreach ($config['ezshaper']['step5'] as $key => $val) {
1620 1620
					if (!is_array($p2plist[$key]))
1621 1621
						continue;
1622 1622
					foreach ($p2plist[$key] as $p2pclient) {
......
1630 1630
						$rule['floating'] = "yes";
1631 1631
						$rule['wizard'] = "yes";
1632 1632
						$rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
1633
						if($p2pclient[1] != '')
1633
						if ($p2pclient[1] != '')
1634 1634
							$rule['protocol'] = $p2pclient[1];
1635 1635
						$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1636 1636
						$config['filter']['rule'][] = $rule;
......
1640 1640

  
1641 1641
			/* loop through gamesplist[] */
1642 1642
			if ($games) {
1643
				foreach($config['ezshaper']['step6'] as $key => $val) {
1643
				foreach ($config['ezshaper']['step6'] as $key => $val) {
1644 1644
					if (!is_array($gamesplist[$key]))
1645 1645
										continue;
1646 1646
					foreach ($gamesplist[$key] as $Gameclient) {
......
1657 1657
						$rule['enabled'] = "on";
1658 1658
						$rule['descr'] = "m_Game {$Gameclient[0]} outbound";
1659 1659
						$rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
1660
						if($Gameclient[1] != '')
1660
						if ($Gameclient[1] != '')
1661 1661
							$rule['protocol'] = $Gameclient[1];
1662 1662
						$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1663 1663
						$config['filter']['rule'][] = $rule;
......
1667 1667

  
1668 1668
	/* loop through othersplist[] */
1669 1669
	if ($otherpriority) {
1670
		foreach($config['ezshaper']['step7'] as $key => $val) {
1670
		foreach ($config['ezshaper']['step7'] as $key => $val) {
1671 1671
			if (!is_array($othersplist[$key]))
1672 1672
				continue;
1673 1673
			foreach ($othersplist[$key] as $otherclient) {
......
1707 1707
					$rule['enabled'] = "on";
1708 1708
					$rule['descr'] = "m_Other {$otherclient[0]} outbound";
1709 1709

  
1710
					if($otherclient[2] or $otherclient[3]) {
1710
					if ($otherclient[2] or $otherclient[3]) {
1711 1711
						$rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
1712 1712
					}
1713
					if($otherclient[1] != '')
1713
					if ($otherclient[1] != '')
1714 1714
						$rule['protocol'] = $otherclient[1];
1715 1715
					$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1716 1716
					$config['filter']['rule'][] = $rule;

Also available in: Unified diff