Projet

Général

Profil

« Précédent | Suivant » 

Révision e0fb12c1

Ajouté par Renato Botelho il y a plus de 9 ans

Fix indent and whitespace

Voir les différences:

usr/local/www/vpn_ipsec.php
136 136
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec">
137 137
	<tr>
138 138
		<td class="tabnavtbl">
139
			<?php
140
				$tab_array = array();
141
				$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
142
				$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
143
				$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
144
				$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
145
				display_top_tabs($tab_array);
146
			?>
139
<?php
140
			$tab_array = array();
141
			$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
142
			$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
143
			$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
144
			$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
145
			display_top_tabs($tab_array);
146
?>
147 147
		</td>
148 148
	</tr>
149 149
	<tr>
......
171 171
					</tr>
172 172
				</table>
173 173
				<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="phase-1 entries">
174
					<?php
175
						$i = 0;
176
						foreach ($a_phase1 as $ph1ent) {
177
							if (isset( $ph1ent['disabled'])) {
178
								$spans = "<span class=\"gray\">";
179
								$spane = "</span>";
180
							}
181
							else
182
								$spans = $spane = "";
183
						
184
						show_ipsec_header($ph1ent);
185
						$counter++; // used to determine if we need to output header manually (no records exist)
186
					?>					
174
<?php
175
				$i = 0;
176
				foreach ($a_phase1 as $ph1ent):
177
					if (isset( $ph1ent['disabled'])) {
178
						$spans = "<span class=\"gray\">";
179
						$spane = "</span>";
180
					}
181
					else
182
						$spans = $spane = "";
183

  
184
					show_ipsec_header($ph1ent);
185
					$counter++; // used to determine if we need to output header manually (no records exist)
186
?>
187 187
					<tr valign="top" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i;?>'">
188 188
						<td class="listlr">
189 189
							<?=$spans;?>
190
							<?php	if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
191
									echo "V1";
192
								else
193
									echo "V2";
194
							?>
190
<?php
191
							if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
192
								echo "V1";
193
							else
194
								echo "V2";
195
?>
195 196
							<?=$spane;?>
196 197
						</td>
197 198
						<td class="listr">
198 199
							<?=$spans;?>
199
							<?php
200
								if ($ph1ent['interface']) {
201
									$iflabels = get_configured_interface_with_descr();
202

  
203
									$carplist = get_configured_carp_interface_list();
204
									foreach ($carplist as $cif => $carpip)
205
										$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
206

  
207
									$aliaslist = get_configured_ip_aliases_list();
208
									foreach ($aliaslist as $aliasip => $aliasif)
209
										$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
210

  
211
									$grouplist = return_gateway_groups_array();
212
									foreach ($grouplist as $name => $group) {
213
										if($group[0]['vip'] <> "")
214
											$vipif = $group[0]['vip'];
215
										else
216
											$vipif = $group[0]['int'];
217
										$iflabels[$name] = "GW Group {$name}";
218
									}
219
									$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
200
<?php
201
							if ($ph1ent['interface']) {
202
								$iflabels = get_configured_interface_with_descr();
203

  
204
								$carplist = get_configured_carp_interface_list();
205
								foreach ($carplist as $cif => $carpip)
206
									$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
207

  
208
								$aliaslist = get_configured_ip_aliases_list();
209
								foreach ($aliaslist as $aliasip => $aliasif)
210
									$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
211

  
212
								$grouplist = return_gateway_groups_array();
213
								foreach ($grouplist as $name => $group) {
214
									if($group[0]['vip'] <> "")
215
										$vipif = $group[0]['vip'];
216
									else
217
										$vipif = $group[0]['int'];
218
									$iflabels[$name] = "GW Group {$name}";
220 219
								}
221
								else
222
									$if = "WAN";
220
								$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
221
							}
222
							else
223
								$if = "WAN";
223 224

  
224
								if (!isset($ph1ent['mobile']))
225
									echo $if."<br />".$ph1ent['remote-gateway'];
226
								else
227
									echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
228
							?>
225
							if (!isset($ph1ent['mobile']))
226
								echo $if."<br />".$ph1ent['remote-gateway'];
227
							else
228
								echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
229
?>
229 230
							<?=$spane;?>
230 231
						</td>
231 232
						<td class="listr">
......
236 237
						<td class="listr">
237 238
							<?=$spans;?>
238 239
							<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?>
239
							<?php
240
								if ($ph1ent['encryption-algorithm']['keylen']) {
241
									if ($ph1ent['encryption-algorithm']['keylen']=="auto")
242
										echo " (" . gettext("auto") . ")";
243
									else
244
										echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
245
								}
246
							?>
240
<?php
241
							if ($ph1ent['encryption-algorithm']['keylen']) {
242
								if ($ph1ent['encryption-algorithm']['keylen']=="auto")
243
									echo " (" . gettext("auto") . ")";
244
								else
245
									echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
246
							}
247
?>
247 248
							<?=$spane;?>
248 249
						</td>
249 250
						<td class="listr">
......
270 271
										</a>
271 272
									</td>
272 273
								</tr>
273
								<?php if (!isset($ph1ent['mobile'])): ?>
274
<?php
275
							if (!isset($ph1ent['mobile'])):
276
?>
274 277
								<tr>
275 278
									<td>
276 279
									</td>
......
280 283
										</a>
281 284
									</td>
282 285
								</tr>
283
								<?php endif; ?>
286
<?php
287
							endif;
288
?>
284 289
							</table>
285 290
						</td>
286 291
					</tr>
287 292
					<tr>
288 293
						<td class="listrborder" colspan="6">
289 294
							<div id="shph2but-<?=$i?>">
290
								<?php
291
									$phase2count=0;
292
									foreach ($a_phase2 as $ph2ent) {
293
										if ($ph2ent['ikeid'] != $ph1ent['ikeid']) 
294
											continue;
295
										$phase2count++;
296
									}
297
								?>								
295
<?php
296
								$phase2count=0;
297
								foreach ($a_phase2 as $ph2ent) {
298
									if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
299
										continue;
300
									$phase2count++;
301
								}
302
?>
298 303
								<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
299 304
							</div>
300 305
							<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" id="tdph2-<?=$i?>" style="display:none" summary="phase-2 entries">
301 306
								<tr>
302 307
									<td class="listhdrr"><?=gettext("Mode"); ?></td>
303
									<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
308
<?php
309
								if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")):
310
?>
304 311
									<td class="listhdrr"><?=gettext("Local Subnet"); ?></td>
305 312
									<td class="listhdrr"><?=gettext("Remote Subnet"); ?></td>
306
									<?php endif; ?>
313
<?php
314
								endif;
315
?>
307 316
									<td class="listhdrr"><?=gettext("P2 Protocol"); ?></td>
308 317
									<td class="listhdrr"><?=gettext("P2 Transforms"); ?></td>
309 318
									<td class="listhdrr"><?=gettext("P2 Auth Methods"); ?></td>
......
313 322
										</a>
314 323
									</td>
315 324
								</tr>
316
							<?php
317
									foreach ($a_phase2 as $ph2ent):
318
										if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
319
											continue;
320

  
321
										if (isset( $ph2ent['disabled']) || isset($ph1ent['disabled'])) {
322
											$spans = "<span class=\"gray\">";
323
											$spane = "</span>";
324
										}
325
										else
326
											$spans = $spane = "";
327
							?>
325
<?php
326
								foreach ($a_phase2 as $ph2ent):
327
									if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
328
										continue;
329

  
330
									if (isset( $ph2ent['disabled']) || isset($ph1ent['disabled'])) {
331
										$spans = "<span class=\"gray\">";
332
										$spane = "</span>";
333
									} else
334
										$spans = $spane = "";
335
?>
328 336
								<tr valign="top" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>'">
329 337

  
330 338
									<td class="listlr nowrap">
331 339
										<?=$spans;?>
332
											<?=$ph2ent['mode'];?>
340
										<?=$ph2ent['mode'];?>
333 341
										<?=$spane;?>
334 342
									</td>
335
									<?php 
336
										if(($ph2ent['mode'] <> "tunnel") and ($ph2ent['mode'] <> "tunnel6")) {
337
											echo "<td class=\"listr nowrap\">&nbsp;</td><td class=\"listr nowrap\">&nbsp;</td>";
338
										} 
339
									?>
340
									<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
341
									<td class="listr nowrap">
342
										<?=$spans;?>
343
											<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
344
										<?=$spane;?>
345
									</td>
346
									<td class="listr nowrap">
347
										<?=$spans;?>
348
											<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
349
										<?=$spane;?>
350
									</td>
351
									<?php endif; ?>
343
<?php
344
									if(($ph2ent['mode'] <> "tunnel") and ($ph2ent['mode'] <> "tunnel6")) {
345
										echo "<td class=\"listr nowrap\">&nbsp;</td><td class=\"listr nowrap\">&nbsp;</td>";
346
									}
347
?>
348
<?php
349
									if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")):
350
?>
351
										<td class="listr nowrap">
352
											<?=$spans;?>
353
												<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
354
											<?=$spane;?>
355
										</td>
356
										<td class="listr nowrap">
357
											<?=$spans;?>
358
												<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
359
											<?=$spane;?>
360
										</td>
361
<?php
362
									endif;
363
?>
352 364
									<td class="listr nowrap">
353 365
										<?=$spans;?>
354
											<?php echo $p2_protos[$ph2ent['protocol']];	?>
366
										<?php echo $p2_protos[$ph2ent['protocol']]; ?>
355 367
										<?=$spane;?>
356 368
									</td>
357 369
									<td class="listr">
358 370
										<?=$spans;?>
359
										<?php
360
											foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
361
												if ($k)
362
													echo ", ";
363
												echo $p2_ealgos[$ph2ea['name']]['name'];
364
												if ($ph2ea['keylen']) {
365
													if ($ph2ea['keylen']=="auto")
366
														echo " (" . gettext("auto") . ")";
367
													else
368
														echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
369
												}
371
<?php
372
										foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
373
											if ($k)
374
												echo ", ";
375
											echo $p2_ealgos[$ph2ea['name']]['name'];
376
											if ($ph2ea['keylen']) {
377
												if ($ph2ea['keylen']=="auto")
378
													echo " (" . gettext("auto") . ")";
379
												else
380
													echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
370 381
											}
371
										?>
382
										}
383
?>
372 384
										<?=$spane;?>
373 385
									</td>
374 386
									<td class="listr nowrap">
375 387
										<?=$spans;?>
376
										<?php
377
											if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
378
												foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
379
													if ($k)
380
														echo ", ";
381
													echo $p2_halgos[$ph2ha];
382
												}
388
<?php
389
										if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
390
											foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
391
												if ($k)
392
													echo ", ";
393
												echo $p2_halgos[$ph2ha];
383 394
											}
384
										?>
395
										}
396
?>
385 397
										<?=$spane;?>
386 398
									</td>
387 399
									<td class="list nowrap">
......
396 408
										</a>
397 409
									</td>
398 410
								</tr>
399

  
400
								<?php endforeach; ?>
401

  
411
<?php
412
								endforeach;
413
?>
402 414
							</table>
403 415
						</td>
404 416
					</tr>
......
407 419
							&nbsp;
408 420
						</td>
409 421
					</tr>
410
					<?php
411
							$i++;
412
						}
413
					if(!$counter)
414
						show_ipsec_header($ph1ent);
415
					?>
422
<?php
423
					$i++;
424
				endforeach;  // $a_phase1 as $ph1ent
425
				if(!$counter)
426
					show_ipsec_header($ph1ent);
427
?>
416 428
					<tr>
417 429
						<td class="list" colspan="6"></td>
418 430
						<td class="list">
......
465 477

  
466 478
function show_ipsec_header($ph1ent) {
467 479
	global $g;
468
	if (isset($ph1ent['mobile'])) 
480
	if (isset($ph1ent['mobile']))
469 481
		$mobile = "&mobile=true";
470 482
	?>
471 483
	<tr>
......
475 487
		<td class="listhdrr"><?=gettext("P1 Protocol"); ?></td>
476 488
		<td class="listhdrr"><?=gettext("P1 Transforms"); ?></td>
477 489
		<td class="listhdrr"><?=gettext("P1 Description"); ?></td>
478
		<td class ="list">
490
		<td class="list">
479 491
		</td>
480 492
	</tr>
481 493

  
482 494
<?php
483
	
495

  
484 496
}
485 497

  
486 498
?>

Formats disponibles : Unified diff