summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_ipsec_leases.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-09-19 08:16:06 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-09-19 08:16:06 -0300
commit93ee78b7d83339476c1fd7b48ec201da72491c22 (patch)
tree1e37eef405168d2c5878b49b4a36db8c32fc4c6a /usr/local/www/diag_ipsec_leases.php
parent880f44c1d8fa3712c18296bca7589d3154e8c06f (diff)
downloadpfsense-93ee78b7d83339476c1fd7b48ec201da72491c22.zip
pfsense-93ee78b7d83339476c1fd7b48ec201da72491c22.tar.gz
Check if there are leases to show, it fixes warning when $mobile['pool'] is empty or not array
Diffstat (limited to 'usr/local/www/diag_ipsec_leases.php')
-rw-r--r--usr/local/www/diag_ipsec_leases.php70
1 files changed, 40 insertions, 30 deletions
diff --git a/usr/local/www/diag_ipsec_leases.php b/usr/local/www/diag_ipsec_leases.php
index 8e4398e..571259d 100644
--- a/usr/local/www/diag_ipsec_leases.php
+++ b/usr/local/www/diag_ipsec_leases.php
@@ -69,42 +69,52 @@ $mobile = ipsec_dump_mobile();
<tr>
<td>
<div id="mainarea">
- <?php foreach($mobile['pool'] as $pool): ?>
+ <?php if (isset($mobile['pool']) && is_array($mobile['pool'])): ?>
+ <?php foreach($mobile['pool'] as $pool): ?>
+ <table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="4" valign="top" class="listtopic">
+ <?php
+ echo gettext("Pool: ") . $pool['name'];
+ echo ' ' . gettext("usage: ") . $pool['usage'];
+ echo ' ' . gettext("online: ") . $pool['online'];
+ ?>
+ </td>
+ </tr>
+ <?php if (is_array($pool['lease']) && count($pool['lease']) > 0): ?>
+ <tr>
+ <td class="listhdrr nowrap"><?=gettext("ID");?></td>
+ <td class="listhdrr nowrap"><?=gettext("Host");?></td>
+ <td class="listhdrr nowrap"><?=gettext("Status");?></td>
+ <td class="list nowrap"></td>
+ </tr>
+ <?php foreach ($pool['lease'] as $lease): ?>
+ <tr>
+ <td class="listlr"><?=htmlspecialchars($lease['id']);?></td>
+ <td class="listr"><?=htmlspecialchars($lease['host']);?></td>
+ <td class="listr"><?=htmlspecialchars($lease['status']);?></td>
+ <td class="list nowrap">
+ </td>
+ </tr>
+ <?php endforeach;
+ else: ?>
+ <tr>
+ <td>
+ <p><strong><?=gettext("No leases from this pool yet.");?></strong></p>
+ </td>
+ </tr>
+ <?php endif; ?>
+ </table>
+ <?php endforeach; ?>
+ <?php else: ?>
<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
- <td colspan="4" valign="top" class="listtopic">
- <?php
- echo gettext("Pool: ") . $pool['name'];
- echo ' ' . gettext("usage: ") . $pool['usage'];
- echo ' ' . gettext("online: ") . $pool['online'];
- ?>
- </td>
- </tr>
- <?php if (is_array($pool['lease']) && count($pool['lease']) > 0): ?>
- <tr>
- <td class="listhdrr nowrap"><?=gettext("ID");?></td>
- <td class="listhdrr nowrap"><?=gettext("Host");?></td>
- <td class="listhdrr nowrap"><?=gettext("Status");?></td>
- <td class="list nowrap"></td>
- </tr>
- <?php foreach ($pool['lease'] as $lease): ?>
- <tr>
- <td class="listlr"><?=htmlspecialchars($lease['id']);?></td>
- <td class="listr"><?=htmlspecialchars($lease['host']);?></td>
- <td class="listr"><?=htmlspecialchars($lease['status']);?></td>
- <td class="list nowrap">
- </td>
- </tr>
- <?php endforeach;
- else: ?>
- <tr>
<td>
- <p><strong><?=gettext("No leases from this pool yet.");?></strong></p>
+ <p><strong><?=gettext("No IPsec pools.");?></strong></p>
</td>
</tr>
- <?php endif; ?>
</table>
- <?php endforeach; ?>
+ <?php endif; ?>
</div>
</td>
</tr>
OpenPOWER on IntegriCloud