Projet

Général

Profil

« Précédent | Suivant » 

Révision 6795e0da

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

Fix indent and spaces

Voir les différences:

usr/local/www/diag_ipsec.php
86 86
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="status ipsec">
87 87
	<tr>
88 88
		<td>
89
			<?php
90
				$tab_array = array();
91
				$tab_array[0] = array(gettext("Overview"), true, "diag_ipsec.php");
92
				$tab_array[1] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
93
				$tab_array[2] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
94
				$tab_array[3] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
95
				$tab_array[4] = array(gettext("Logs"), false, "diag_logs_ipsec.php");
96
				display_top_tabs($tab_array);
97
			?>
89
<?php
90
			$tab_array = array();
91
			$tab_array[0] = array(gettext("Overview"), true, "diag_ipsec.php");
92
			$tab_array[1] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
93
			$tab_array[2] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
94
			$tab_array[3] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
95
			$tab_array[4] = array(gettext("Logs"), false, "diag_logs_ipsec.php");
96
			display_top_tabs($tab_array);
97
?>
98 98
		</td>
99 99
	</tr>
100 100
	<tr>
101
	<td>
102
	<div id="mainarea">
101
		<td>
102
		<div id="mainarea">
103 103
		<table width="100%" border="0" cellpadding="6" cellspacing="0" class="tabcont sortable" summary="status">
104 104
		<thead>
105 105
			<tr>
......
112 112
				<th class="listhdrr nowrap"><?php echo gettext("Reauth");?></th>
113 113
				<th class="listhdrr nowrap"><?php echo gettext("Algo");?></th>
114 114
				<th class="listhdrr nowrap"><?php echo gettext("Status");?></th>
115
				<td class="list nowrap"></td>
116
		</tr>
115
				<th class="list nowrap"></th>
116
			</tr>
117 117
		</thead>
118 118
		<tbody>
119 119
<?php
120 120
	$ipsecconnected = array();
121
	if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_array($status['query']['ikesalist']['ikesa'])) {
122
		foreach ($status['query']['ikesalist']['ikesa'] as $ikeid => $ikesa) {
121
	if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_array($status['query']['ikesalist']['ikesa'])):
122
		foreach ($status['query']['ikesalist']['ikesa'] as $ikeid => $ikesa):
123 123
			$con_id = substr($ikesa['peerconfig'], 3);
124 124
			$ipsecconnected[$con_id] = $con_id;
125 125

  
126
			if (ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ikesa['id'])) {
126
			if (ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ikesa['id']))
127 127
				$icon = "pass";
128
			} elseif(!isset($config['ipsec']['enable'])) {
128
			elseif (!isset($config['ipsec']['enable']))
129 129
				$icon = "block";
130
			} else {
130
			else
131 131
				$icon = "reject";
132
			}
133 132
?>
134 133
			<tr>
135 134
				<td class="listlr">
136
					<?php echo htmlspecialchars(ipsec_get_descr($con_id));?>
135
<?php
136
					echo htmlspecialchars(ipsec_get_descr($con_id));
137
?>
137 138
				</td>
138 139
				<td class="listr">
139
			<?php   if (!is_array($ikesa['local']))
140
<?php
141
				if (!is_array($ikesa['local']))
140 142
					echo "Unknown";
141 143
				else {
142 144
					if (!empty($ikesa['local']['identification'])) {
......
147 149
					} else
148 150
						echo 'Unknown';
149 151
				}
150
			?>
152
?>
151 153
				</td>
152 154
				<td class="listr">
153
			<?php   if (!is_array($ikesa['local']))
155
<?php
156
				if (!is_array($ikesa['local']))
154 157
					echo "Unknown";
155 158
				else {
156 159
					if (!empty($ikesa['local']['address']))
......
160 163
					if ($ikesa['local']['nat'] != 'false')
161 164
						echo " NAT-T";
162 165
				}
163
			?>
166
?>
164 167
				</td>
165 168
				<td class="listr">
166
			<?php   if (!is_array($ikesa['remote']))
169
<?php
170
				if (!is_array($ikesa['remote']))
167 171
					echo "Unknown";
168 172
				else {
169 173
					$identity = "";
......
184 188
							echo $identity;
185 189
					}
186 190
				}
187
			?>
191
?>
188 192
				</td>
189 193
				<td class="listr">
190
			<?php   if (!is_array($ikesa['remote']))
194
<?php
195
				if (!is_array($ikesa['remote']))
191 196
					echo "Unknown";
192 197
				else {
193 198
					if (!empty($ikesa['remote']['address']))
......
197 202
					if ($ikesa['remote']['nat'] != 'false')
198 203
						echo " NAT-T";
199 204
				}
200
			?>
205
?>
201 206
				</td>
202 207
				<td class="listr">
203 208
					IKEv<?php echo htmlspecialchars($ikesa['version']);?>
204 209
					<br/>
205
					<?php echo htmlspecialchars($ikesa['role']);?>
206
					
210
<?php
211
					echo htmlspecialchars($ikesa['role']);
212
?>
207 213
				</td>
208 214
				<td class="listr">
209
					<?php echo htmlspecialchars($ikesa['reauth']);?>
215
<?php
216
					echo htmlspecialchars($ikesa['reauth']);
217
?>
210 218
				</td>
211 219
				<td class="listr">
212
					<?php
213
						echo htmlspecialchars($ikesa['encalg']);
214
						echo "<br/>";
215
						echo htmlspecialchars($ikesa['intalg']);
216
						echo "<br/>";
217
						echo htmlspecialchars($ikesa['prfalg']);
218
						echo "<br/>";
219
						echo htmlspecialchars($ikesa['dhgroup']);
220
					?>
220
<?php
221
					echo htmlspecialchars($ikesa['encalg']);
222
					echo "<br/>";
223
					echo htmlspecialchars($ikesa['intalg']);
224
					echo "<br/>";
225
					echo htmlspecialchars($ikesa['prfalg']);
226
					echo "<br/>";
227
					echo htmlspecialchars($ikesa['dhgroup']);
228
?>
221 229
				</td>
222 230
				<td class="listr">
223 231
					<center>
......
227 235
					</center>
228 236
				</td>
229 237
				<td >
230
				<?php if ($icon != "pass"): ?>
238
<?php
239
				if ($icon != "pass"):
240
?>
231 241
					<center>
232 242
						<a href="diag_ipsec.php?act=connect&amp;ikeid=<?php echo $con_id; ?>">
233 243
						<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0"/>
234 244
						</a>
235 245
					</center>
236
				<?php else: ?>
246
<?php
247
				else:
248
?>
237 249
					<center>
238 250
						<a href="diag_ipsec.php?act=ikedisconnect&amp;ikeid=<?php echo $con_id; ?>">
239 251
						<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_stop.gif" alt="Disconnect VPN" title="Disconnect VPN" border="0"/>
......
242 254
						<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" alt="Disconnect VPN Connection" title="Disconnect VPN Connection" border="0"/>
243 255
						</a>
244 256
					</center>
245
				<?php endif; ?>
257
<?php
258
				endif;
259
?>
246 260
				</td>
247 261
				<td valign="middle" class="list nowrap">
248 262
					<table border="0" cellspacing="0" cellpadding="1" summary="">
249 263
					</table>
250 264
				</td>
251 265
			</tr>
252
			<?php if (is_array($ikesa['childsalist'])): ?>
266
<?php
267
			if (is_array($ikesa['childsalist'])):
268
?>
253 269
			<tr>
254 270
				<td class="listrborder" colspan="9">
255 271
				<div id="btnchildsa-<?=$ikeid;?>">
256 272
					<input  type="button" onclick="show_childsa('childsa-<?=$ikeid;?>','btnchildsa-<?=$ikeid;?>');" value="+" /> - Show child SA entries
257 273
				</div>
258 274
				<table class="tabcont" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" id="childsa-<?=$ikeid;?>" style="display:none" summary="">
259
				<thead>
260
					<tr>
261
						<th class="listhdrr nowrap"><?php echo gettext("Local subnets");?></th>
262
						<th class="listhdrr nowrap"><?php echo gettext("Local SPI(s)");?></th>
263
						<th class="listhdrr nowrap"><?php echo gettext("Remote subnets");?></th>
264
						<th class="listhdrr nowrap"><?php echo gettext("Times");?></th>
265
						<th class="listhdrr nowrap"><?php echo gettext("Algo");?></th>
266
						<th class="listhdrr nowrap"><?php echo gettext("Stats");?></th>
267
					</tr>
268
				</thead>
269
				<tbody>
270
				<?php
271
					if (is_array($ikesa['childsalist']['childsa'])) {
272
						foreach ($ikesa['childsalist']['childsa'] as $childsa) {
273
				?>
274
					<tr valign="top">
275
						<td class="listlr nowrap">
276
				<?php	if (is_array($childsa['local']) && is_array($childsa['local']['networks']) && is_array($childsa['local']['networks']['network'])) {
277
						foreach ($childsa['local']['networks']['network'] as $lnets) {
278
							echo htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />";
279
						}
280
					} else
281
						echo "Unknown";
282
				?>
283
						</td>
284
						<td class="listr nowrap">
285
				<?php	if (is_array($childsa['local']))
286
						echo "Local: " . htmlspecialchars($childsa['local']['spi']);
287
				?>
288
				<?php	if (is_array($childsa['remote']))
289
						echo "<br/>Remote: " . htmlspecialchars($childsa['remote']['spi']);
290
				?>
291
						</td>
292
						<td class="listr nowrap">
293
				<?php	if (is_array($childsa['remote']) && is_array($childsa['remote']['networks']) && is_array($childsa['remote']['networks']['network'])) {
294
						foreach ($childsa['remote']['networks']['network'] as $rnets) {
295
							echo htmlspecialchars(ipsec_fixup_network($rnets)) . "<br />";
296
						}
297
					} else
298
						echo "Unknown";
299
				?>
300
						</td>
301
						<td class="listr nowrap">
302
							<?php
275
					<thead>
276
						<tr>
277
							<th class="listhdrr nowrap"><?php echo gettext("Local subnets");?></th>
278
							<th class="listhdrr nowrap"><?php echo gettext("Local SPI(s)");?></th>
279
							<th class="listhdrr nowrap"><?php echo gettext("Remote subnets");?></th>
280
							<th class="listhdrr nowrap"><?php echo gettext("Times");?></th>
281
							<th class="listhdrr nowrap"><?php echo gettext("Algo");?></th>
282
							<th class="listhdrr nowrap"><?php echo gettext("Stats");?></th>
283
						</tr>
284
					</thead>
285
					<tbody>
286
<?php
287
				if (is_array($ikesa['childsalist']['childsa'])):
288
					foreach ($ikesa['childsalist']['childsa'] as $childsa):
289
?>
290
						<tr valign="top">
291
							<td class="listlr nowrap">
292
<?php
293
							if (is_array($childsa['local']) &&
294
							    is_array($childsa['local']['networks']) &&
295
							    is_array($childsa['local']['networks']['network']))
296
								foreach ($childsa['local']['networks']['network'] as $lnets)
297
									echo htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />";
298
							else
299
								echo "Unknown";
300
?>
301
							</td>
302
							<td class="listr nowrap">
303
<?php
304
							if (is_array($childsa['local']))
305
								echo "Local: " . htmlspecialchars($childsa['local']['spi']);
306
							if (is_array($childsa['remote']))
307
								echo "<br/>Remote: " . htmlspecialchars($childsa['remote']['spi']);
308
?>
309
							</td>
310
							<td class="listr nowrap">
311
<?php
312
							if (is_array($childsa['remote']) &&
313
							    is_array($childsa['remote']['networks']) &&
314
							    is_array($childsa['remote']['networks']['network']))
315
								foreach ($childsa['remote']['networks']['network'] as $rnets)
316
									echo htmlspecialchars(ipsec_fixup_network($rnets)) . "<br />";
317
							else
318
								echo "Unknown";
319
?>
320
							</td>
321
							<td class="listr nowrap">
322
<?php
303 323
								echo "Rekey: " . htmlspecialchars($childsa['rekey']);
304 324
								echo "<br/>Life: " . htmlspecialchars($childsa['lifetime']);
305 325
								echo "<br/>Install: " .htmlspecialchars($childsa['installtime']);
306 326

  
307
							?>
308
						</td>
309
						<td class="listr nowrap">
310
						<?php
311
							echo htmlspecialchars($childsa['encalg']);
312
							echo "<br/>";
313
							echo htmlspecialchars($childsa['intalg']);
314
							echo "<br/>";
315
							if (!empty($childsa['prfalg'])) {
316
								echo htmlspecialchars($childsa['prfalg']);
327
?>
328
							</td>
329
							<td class="listr nowrap">
330
<?php
331
								echo htmlspecialchars($childsa['encalg']);
317 332
								echo "<br/>";
318
							}
319
							if (!empty($childsa['dhgroup'])) {
320
								echo htmlspecialchars($childsa['dhgroup']);
333
								echo htmlspecialchars($childsa['intalg']);
321 334
								echo "<br/>";
322
							}
323
							if (!empty($childsa['esn'])) {
324
								echo htmlspecialchars($childsa['esn']);
335
								if (!empty($childsa['prfalg'])) {
336
									echo htmlspecialchars($childsa['prfalg']);
337
									echo "<br/>";
338
								}
339
								if (!empty($childsa['dhgroup'])) {
340
									echo htmlspecialchars($childsa['dhgroup']);
341
									echo "<br/>";
342
								}
343
								if (!empty($childsa['esn'])) {
344
									echo htmlspecialchars($childsa['esn']);
345
									echo "<br/>";
346
								}
347
								echo "IPComp: " . htmlspecialchars($childsa['ipcomp']);
348
?>
349
							</td>
350
							<td class="listr nowrap">
351
<?php
352
								echo "Bytes-In: " . htmlspecialchars($childsa['bytesin']) . "<br/>Packets-In: " . htmlspecialchars($childsa['packetsin']);;
325 353
								echo "<br/>";
326
							}
327
							echo "IPComp: " . htmlspecialchars($childsa['ipcomp']);
328
						?>
329
						</td>
330
						<td class="listr nowrap">
331
						<?php
332
							echo "Bytes-In: " . htmlspecialchars($childsa['bytesin']) . "<br/>Packets-In: " . htmlspecialchars($childsa['packetsin']);;
333
							echo "<br/>";
334
							echo "Bytes-Out: " . htmlspecialchars($childsa['bytesout']) . "<br/>Packets-Out: " . htmlspecialchars($childsa['packetsout']);;
335
						?>
336
						</td>
337
						<td>
338
							<center>
339
								<a href="diag_ipsec.php?act=childdisconnect&amp;ikeid=<?php echo $con_id; ?>&amp;ikesaid=<?php echo $childsa['reqid']; ?>">
340
								<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" alt="Disconnect Child SA" title="Disconnect Child SA" border="0"/>
341
								</a>
342
							</center>
343
						</td>
344
						<td class="list nowrap">
345
							&nbsp;
346
						</td>
347
					</tr>
348
				<?php } } ?>
349
					<tr style="display:none;"><td></td></tr>
350
				</tbody>
354
								echo "Bytes-Out: " . htmlspecialchars($childsa['bytesout']) . "<br/>Packets-Out: " . htmlspecialchars($childsa['packetsout']);;
355
?>
356
							</td>
357
							<td>
358
								<center>
359
									<a href="diag_ipsec.php?act=childdisconnect&amp;ikeid=<?php echo $con_id; ?>&amp;ikesaid=<?php echo $childsa['reqid']; ?>">
360
									<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" alt="Disconnect Child SA" title="Disconnect Child SA" border="0"/>
361
									</a>
362
								</center>
363
							</td>
364
							<td class="list nowrap">
365
								&nbsp;
366
							</td>
367
						</tr>
368
<?php
369
					endforeach;
370
				endif;
371
?>
372
						<tr style="display:none;"><td></td></tr>
373
					</tbody>
351 374
				</table>
352 375
				</td>
353 376
			</tr>
354
			<?php endif; 
377
<?php
378
			endif;
355 379

  
356 380
			unset($con_id);
357
		}
358
	}
381
		endforeach;
382
	endif;
359 383

  
360 384
	$rgmap = array();
361 385
	foreach ($a_phase1 as $ph1ent):
......
363 387
		if ($ipsecconnected[$ph1ent['ikeid']])
364 388
			continue;
365 389
?>
366
		<tr>
367
			<td class="listlr">
368
				<?php echo htmlspecialchars($ph1ent['descr']);?>
369
			</td>
370
			<td class="listr">
371
		<?php
372
			list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
373
			if (empty($myid_data))
374
				echo "Unknown";
375
			else
376
				echo htmlspecialchars($myid_data);
377
		?>
378
			</td>
379
			<td class="listr">
380
		<?php
381
			$ph1src = ipsec_get_phase1_src($ph1ent);
382
			if (empty($ph1src))
383
				echo "Unknown";
384
			else
385
				echo htmlspecialchars($ph1src);
386
		?>
387
			</td>
388
			<td class="listr">
389
		<?php
390
			list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
391
			if (empty($peerid_data))
392
				echo "Unknown";
393
			else
394
				echo htmlspecialchars($peerid_data);
395
		?>
396
			</td>
397
			<td class="listr">
398
		<?php
399
			$ph1src = ipsec_get_phase1_dst($ph1ent);
400
			if (empty($ph1src))
401
				echo "Unknown";
402
			else
403
				echo htmlspecialchars($ph1src);
404
		?>
405
			</td>
406
			<td class="listr" >
407
			</td>
408
			<td class="listr" >
409
			</td>
410
			<td class="listr" >
411
			</td>
412
			<td class="listr">
413
				<center>
414
					<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_reject.gif" title="Disconnected" alt=""/>
415
					<br/>Disconnected
416
				</center>
417
			</td>
418
			<td >
419
				<center>
420
					<a href="diag_ipsec.php?act=connect&amp;ikeid=<?php echo $ph1ent['ikeid']; ?>">
421
					<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0"/>
422
					</a>
423
				</center>
424
			</td>
425
			<td valign="middle" class="list nowrap">
426
				<table border="0" cellspacing="0" cellpadding="1" summary="">
427
				</table>
428
			</td>
429
		</tr>
390
			<tr>
391
				<td class="listlr">
392
<?php
393
					echo htmlspecialchars($ph1ent['descr']);
394
?>
395
				</td>
396
				<td class="listr">
397
<?php
398
				list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
399
				if (empty($myid_data))
400
					echo "Unknown";
401
				else
402
					echo htmlspecialchars($myid_data);
403
?>
404
				</td>
405
				<td class="listr">
406
<?php
407
				$ph1src = ipsec_get_phase1_src($ph1ent);
408
				if (empty($ph1src))
409
					echo "Unknown";
410
				else
411
					echo htmlspecialchars($ph1src);
412
?>
413
				</td>
414
				<td class="listr">
415
<?php
416
				list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
417
				if (empty($peerid_data))
418
					echo "Unknown";
419
				else
420
					echo htmlspecialchars($peerid_data);
421
?>
422
				</td>
423
				<td class="listr">
424
<?php
425
				$ph1src = ipsec_get_phase1_dst($ph1ent);
426
				if (empty($ph1src))
427
					echo "Unknown";
428
				else
429
					echo htmlspecialchars($ph1src);
430
?>
431
				</td>
432
				<td class="listr" >
433
				</td>
434
				<td class="listr" >
435
				</td>
436
				<td class="listr" >
437
				</td>
438
				<td class="listr">
439
					<center>
440
						<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_reject.gif" title="Disconnected" alt=""/>
441
						<br/>Disconnected
442
					</center>
443
				</td>
444
				<td >
445
					<center>
446
						<a href="diag_ipsec.php?act=connect&amp;ikeid=<?php echo $ph1ent['ikeid']; ?>">
447
						<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0"/>
448
						</a>
449
					</center>
450
				</td>
451
				<td valign="middle" class="list nowrap">
452
					<table border="0" cellspacing="0" cellpadding="1" summary="">
453
					</table>
454
				</td>
455
			</tr>
430 456
<?php
431 457
	endforeach;
432 458
	unset($ipsecconnected, $phase1, $rgmap);

Formats disponibles : Unified diff