Projet

Général

Profil

« Précédent | Suivant » 

Révision 93ee78b7

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

Check if there are leases to show, it fixes warning when $mobile['pool'] is empty or not array

Voir les différences:

usr/local/www/diag_ipsec_leases.php
69 69
		<tr>
70 70
			<td>
71 71
				<div id="mainarea">
72
				<?php foreach($mobile['pool'] as $pool): ?>
72
				<?php if (isset($mobile['pool']) && is_array($mobile['pool'])): ?>
73
					<?php foreach($mobile['pool'] as $pool): ?>
74
						<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
75
							<tr>
76
								<td colspan="4" valign="top" class="listtopic">
77
								<?php
78
									echo gettext("Pool: ") . $pool['name'];
79
									echo ' ' . gettext("usage: ") . $pool['usage'];
80
									echo ' ' . gettext("online: ") . $pool['online'];
81
								?>
82
								</td>
83
							</tr>
84
							<?php if (is_array($pool['lease']) && count($pool['lease']) > 0): ?>
85
							<tr>
86
								<td class="listhdrr nowrap"><?=gettext("ID");?></td>
87
								<td class="listhdrr nowrap"><?=gettext("Host");?></td>
88
								<td class="listhdrr nowrap"><?=gettext("Status");?></td>
89
								<td class="list nowrap"></td>
90
							</tr>
91
							<?php foreach ($pool['lease'] as $lease): ?>
92
							<tr>
93
								<td class="listlr"><?=htmlspecialchars($lease['id']);?></td>
94
								<td class="listr"><?=htmlspecialchars($lease['host']);?></td>
95
								<td class="listr"><?=htmlspecialchars($lease['status']);?></td>
96
								<td class="list nowrap">
97
								</td>
98
							</tr>
99
							<?php endforeach;
100
							else: ?>
101
							<tr>
102
								<td>
103
									<p><strong><?=gettext("No leases from this pool yet.");?></strong></p>
104
								</td>
105
							</tr>
106
							<?php endif; ?>
107
						</table>
108
					<?php endforeach; ?>
109
				<?php else: ?>
73 110
					<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
74
						<tr>
75
							<td colspan="4" valign="top" class="listtopic">
76
							<?php
77
								echo gettext("Pool: ") . $pool['name'];
78
								echo ' ' . gettext("usage: ") . $pool['usage'];
79
								echo ' ' . gettext("online: ") . $pool['online'];
80
							?>
81
							</td>
82
						</tr>
83
						<?php if (is_array($pool['lease']) && count($pool['lease']) > 0): ?>
84
						<tr>
85
							<td class="listhdrr nowrap"><?=gettext("ID");?></td>
86
							<td class="listhdrr nowrap"><?=gettext("Host");?></td>
87
							<td class="listhdrr nowrap"><?=gettext("Status");?></td>
88
							<td class="list nowrap"></td>
89
						</tr>
90
						<?php foreach ($pool['lease'] as $lease): ?>
91
						<tr>
92
							<td class="listlr"><?=htmlspecialchars($lease['id']);?></td>
93
							<td class="listr"><?=htmlspecialchars($lease['host']);?></td>
94
							<td class="listr"><?=htmlspecialchars($lease['status']);?></td>
95
							<td class="list nowrap">
96
							</td>
97
						</tr>
98
						<?php endforeach;
99
						else: ?>
100 111
						<tr>
101 112
							<td>
102
								<p><strong><?=gettext("No leases from this pool yet.");?></strong></p>
113
								<p><strong><?=gettext("No IPsec pools.");?></strong></p>
103 114
							</td>
104 115
						</tr>
105
						<?php endif; ?>
106 116
					</table>
107
				<?php endforeach; ?>
117
				<?php endif; ?>
108 118
				</div>
109 119
			</td>
110 120
		</tr>

Formats disponibles : Unified diff