Project

General

Profile

« Previous | Next » 

Revision e92ee598

Added by Phil Davis about 10 years ago

Code style services unbound

View differences:

usr/local/www/services_unbound_acls.php
85 85
	if ($_POST['apply']) {
86 86
		$retval = services_unbound_configure();
87 87
		$savemsg = get_std_save_message($retval);
88
		if ($retval == 0)
88
		if ($retval == 0) {
89 89
			clear_subsystem_dirty('unbound');
90
		}
90 91
	} else {
91 92

  
92 93
		// input validation - only allow 50 entries in a single ACL
93
		for($x=0; $x<50; $x++) {
94
		for ($x=0; $x<50; $x++) {
94 95
			if (isset($pconfig["acl_network{$x}"])) {
95 96
				$networkacl[$x] = array();
96 97
				$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
......
143 144
				pfSenseHeader("/services_unbound_acls.php");
144 145
				exit;
145 146
			}
146

  
147 147
		}
148 148
	}
149 149
}
......
201 201
		<tr>
202 202
			<td id="mainarea">
203 203
				<div class="tabcont">
204
					<?php if($act=="new" || $act=="edit"): ?>
205
						<input name="aclid" type="hidden" value="<?=$id;?>" />
206
						<input name="act" type="hidden" value="<?=$act;?>" />
204
<?php
205
	if ($act == "new" || $act == "edit"):
206
?>
207
					<input name="aclid" type="hidden" value="<?=$id;?>" />
208
					<input name="act" type="hidden" value="<?=$act;?>" />
207 209

  
208 210
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
209 211
						<tr>
210
							<td colspan="2" valign="top" class="listtopic"><?=ucwords(sprintf(gettext("%s Access List"),$act));?></td>
212
							<td colspan="2" valign="top" class="listtopic"><?=ucwords(sprintf(gettext("%s Access List"), $act));?></td>
211 213
						</tr>
212 214
						<tr>
213 215
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Access List name");?></td>
......
221 223
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Action");?></td>
222 224
							<td width="78%" class="vtable">
223 225
								<select name="aclaction" class="formselect">
224
									<?php $types = explode(",", "Allow,Deny,Refuse,Allow Snoop"); foreach ($types as $type): ?>
226
									<?php
227
										$types = explode(",", "Allow,Deny,Refuse,Allow Snoop");
228
										foreach ($types as $type):
229
									?>
225 230
									<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['aclaction'])) echo "selected=\"selected\""; ?>>
226 231
									<?=htmlspecialchars($type);?>
227 232
									</option>
228
									<?php endforeach; ?>
233
									<?php
234
										endforeach;
235
									?>
229 236
								</select>
230 237
								<br />
231 238
								<span class="vexpl">
......
247 254
										<td><div id="twocolumn"><?=gettext("CIDR");?></div></td>
248 255
										<td><div id="threecolumn"><?=gettext("Description");?></div></td>
249 256
									</tr>
250
									<?php $counter = 0; ?>
251 257
									<?php
252
										if($networkacl)
253
											foreach($networkacl as $item):
254
									?>
255
											<?php
258
										$counter = 0;
259
										if ($networkacl) {
260
											foreach ($networkacl as $item):
256 261
												$network = $item['acl_network'];
257 262
												$cidr = $item['mask'];
258 263
												$description = $item['description'];
259
											?>
264
									?>
260 265
									<tr>
261 266
										<td>
262 267
											<input name="acl_network<?=$counter;?>" type="text" class="formfld unknown ipv4v6" id="acl_network<?=$counter;?>" size="30" value="<?=htmlspecialchars($network);?>" />
......
279 284
											<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
280 285
										</td>
281 286
									</tr>
282
									<?php $counter++; ?>
283
									<?php endforeach; ?>
287
									<?php
288
												$counter++;
289
											endforeach;
290
										}
291
									?>
284 292
								</tbody>
285 293
							</table>
286 294
							<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
......
318 326
							</td>
319 327
						</tr>
320 328
					</table>
321

  
322
				<?php else: ?>
323

  
324
				<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="results">
329
<?php
330
	else:
331
?>
332
					<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="results">
325 333
					<thead>
326 334
						<tr>
327 335
							<td width="25%" class="listhdrr"><?=gettext("Access List Name"); ?></td>
......
337 345
								<table border="0" cellspacing="0" cellpadding="1" summary="icons">
338 346
									<tr>
339 347
										<td width="17">&nbsp;</td>
340
										<td valign="middle"><a href="services_unbound_acls.php?act=new">
341
											<img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Add new Access List"); ?>" border="0" alt="add" />
342
										</a></td>
348
										<td valign="middle">
349
											<a href="services_unbound_acls.php?act=new">
350
												<img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Add new Access List"); ?>" border="0" alt="add" />
351
											</a>
352
										</td>
343 353
									</tr>
344 354
								</table>
345 355
							</td>
......
355 365
					<tbody>
356 366
					<?php
357 367
						$i = 0;
358
						foreach($a_acls as $acl):
368
						foreach ($a_acls as $acl):
359 369
					?>
360 370
						<tr ondblclick="document.location='services_unbound_acls.php?act=edit&amp;id=<?=$i;?>'">
361 371
							<td class="listlr">
......
370 380
							<td valign="middle" class="list nowrap">
371 381
								<table border="0" cellspacing="0" cellpadding="1" summary="icons">
372 382
									<tr>
373
										<td valign="middle"><a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>">
374
											<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit access list"); ?>" width="17" height="17" border="0" alt="edit" />
375
										</a></td>
376
										<td valign="middle"><a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')">
377
											<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete access list"); ?>" width="17" height="17" border="0" alt="delete" />
378
										</a></td>
383
										<td valign="middle">
384
											<a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>">
385
												<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit access list"); ?>" width="17" height="17" border="0" alt="edit" />
386
											</a>
387
										</td>
388
										<td valign="middle">
389
											<a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')">
390
												<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete access list"); ?>" width="17" height="17" border="0" alt="delete" />
391
											</a>
392
										</td>
379 393
									</tr>
380 394
								</table>
381 395
							</td>
382 396
						</tr>
383 397
					<?php
384
						$i++;
398
							$i++;
385 399
						endforeach;
386 400
					?>
387
					<tr style="display:none"><td></td></tr>
401
						<tr style="display:none"><td></td></tr>
388 402
					</tbody>
389
				</table>
390
			<?php endif; ?>
391
			</div>
403
					</table>
404
<?php
405
	endif;
406
?>
407
				</div>
392 408
			</td>
393 409
		</tr>
394 410
	</tbody>

Also available in: Unified diff