Commit 1206b9b7 authored by Manuel Faux's avatar Manuel Faux Committed by Franco Fichtner

Firewall: added tooltip to used aliases

Tooltip shows description of alias.
parent 0b6f42c5
...@@ -1004,6 +1004,28 @@ function alias_expand($name) { ...@@ -1004,6 +1004,28 @@ function alias_expand($name) {
} }
} }
/* get description of alias */
function get_alias_description($name)
{
global $config;
if (is_alias($name))
{
if (isset($config['aliases']['alias']))
{
foreach ($config['aliases']['alias'] as $alias)
{
if ($alias['name'] == $name)
{
return (isset($alias['descr'])) ? $alias['descr'] : "";
}
}
return null;
}
}
}
function subnet_size($subnet) { function subnet_size($subnet) {
if (is_subnetv4($subnet)) { if (is_subnetv4($subnet)) {
list ($ip, $bits) = explode("/", $subnet); list ($ip, $bits) = explode("/", $subnet);
......
...@@ -323,36 +323,70 @@ $( document ).ready(function() { ...@@ -323,36 +323,70 @@ $( document ).ready(function() {
<td> <td>
<?=strtoupper($natent['protocol']);?> <?=strtoupper($natent['protocol']);?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($natent['source']));?>
<?php if (isset($natent['source']['address']) && is_alias($natent['source']['address'])): ?> <?php if (isset($natent['source']['address']) && is_alias($natent['source']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($natent['source']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($natent['source'])); ?>
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($natent['source'])); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port($natent['source']['port']));?> <?php if (isset($natent['source']['port']) && is_alias($natent['source']['port'])): ?>
<?php if (is_alias($natent['source']['port'])): ?> <span title="<?=htmlspecialchars(get_alias_description($natent['source']['port']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['port']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars(pprint_port($natent['source']['port'])); ?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['port']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_port(isset($natent['source']['port']) ? $natent['source']['port'] : null)); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($natent['destination']));?>
<?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?> <?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($natent['destination']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($natent['destination'])); ?>
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($natent['destination'])); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port($natent['destination']['port']));?> <?php if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])): ?>
<?php if (is_alias($natent['destination']['port'])): ?> <span title="<?=htmlspecialchars(get_alias_description($natent['destination']['port']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['port']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars(pprint_port($natent['destination']['port'])); ?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['port']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_port(isset($natent['destination']['port']) ? $natent['destination']['port'] : null)); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?=$natent['target'];?> <?=$natent['target'];?>
<?php if (is_alias($natent['target'])): ?> <?php if (is_alias($natent['target'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=$natent['target'];?>"><i class="fa fa-list"></i> </a> &nbsp;<a href="/firewall_aliases_edit.php?name=<?=$natent['target'];?>"><i class="fa fa-list"></i> </a>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?php <?php
$localport = $natent['local-port']; $localport = $natent['local-port'];
...@@ -362,11 +396,19 @@ $( document ).ready(function() { ...@@ -362,11 +396,19 @@ $( document ).ready(function() {
$localport .= '-' . $localendport; $localport .= '-' . $localendport;
} }
?> ?>
<?=htmlspecialchars(pprint_port($localport));?> <?php if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])): ?>
<?php if (is_alias($localport)): ?> <span title="<?=htmlspecialchars(get_alias_description($localport));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($localport);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars(pprint_port($localport));?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($localport);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_port($localport));?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?=$natent['descr'];?> <?=$natent['descr'];?>
</td> </td>
...@@ -388,6 +430,7 @@ $( document ).ready(function() { ...@@ -388,6 +430,7 @@ $( document ).ready(function() {
</tr> </tr>
<?php $nnats++; endforeach; ?> <?php $nnats++; endforeach; ?>
<tr> <tr>
<td colspan="8"></td> <td colspan="8"></td>
<td class="hidden-xs hidden-sm" colspan="4"> </td> <td class="hidden-xs hidden-sm" colspan="4"> </td>
<td> <td>
......
...@@ -231,15 +231,29 @@ $main_buttons = array( ...@@ -231,15 +231,29 @@ $main_buttons = array(
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?=pprint_address($natent['source']);?>
<?php if (isset($natent['source']['address']) && is_alias($natent['source']['address'])): ?> <?php if (isset($natent['source']['address']) && is_alias($natent['source']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($natent['source']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($natent['source']));?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($natent['source']));?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?=pprint_address($natent['destination']);?>
<?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?> <?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($natent['destination']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($natent['destination']));?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($natent['destination']));?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
......
...@@ -363,10 +363,17 @@ include("head.inc"); ...@@ -363,10 +363,17 @@ include("head.inc");
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?> <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?= $natent['source']['network'] == "(self)" ? "This Firewall" : $natent['source']['network']; ?> <?php if (isset($natent['source']['network']) && is_alias($natent['source']['network'])): ?>
<?php if (isset($natent['source']['network']) && is_alias($natent['source']['network'])): ?> <span title="<?=htmlspecialchars(get_alias_description($natent['source']['network']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['network']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars($natent['source']['network']);?>&nbsp;
<?php endif; ?> </span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['network']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=$natent['source']['network'] == "(self)" ? gettext("This Firewall") : htmlspecialchars($natent['source']['network']); ?>&nbsp;
<?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?> <?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
...@@ -374,10 +381,17 @@ include("head.inc"); ...@@ -374,10 +381,17 @@ include("head.inc");
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=isset($natent['destination']['not']) ? "!&nbsp;" :"";?> <?=isset($natent['destination']['not']) ? "!&nbsp;" :"";?>
<?=isset($natent['destination']['any']) ? "*" : $natent['destination']['address'] ;?> <?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?>
<?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?> <span title="<?=htmlspecialchars(get_alias_description($natent['destination']['address']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars($natent['destination']['address']);?>&nbsp;
<?php endif; ?> </span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=isset($natent['destination']['any']) ? "*" : htmlspecialchars($natent['destination']['address']);?>
<?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?> <?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
...@@ -395,10 +409,17 @@ include("head.inc"); ...@@ -395,10 +409,17 @@ include("head.inc");
else else
$nat_address = $natent['target']; $nat_address = $natent['target'];
?> ?>
<?=htmlspecialchars($nat_address);?> <?php if (isset($natent['target']) && is_alias($natent['target'])): ?>
<?php if (isset($natent['target']) && is_alias($natent['target'])): ?> <span title="<?=htmlspecialchars(get_alias_description($natent['target']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['target']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars($nat_address);?>&nbsp;
<?php endif; ?> </span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['target']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars($nat_address);?>
<?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=empty($natent['natport']) ? "*" : htmlspecialchars($natent['natport']);?> <?=empty($natent['natport']) ? "*" : htmlspecialchars($natent['natport']);?>
......
...@@ -446,6 +446,7 @@ $( document ).ready(function() { ...@@ -446,6 +446,7 @@ $( document ).ready(function() {
<span class="glyphicon glyphicon-info-sign <?=!empty($filterent['disabled']) ? "text-muted" :""?>"></span> <span class="glyphicon glyphicon-info-sign <?=!empty($filterent['disabled']) ? "text-muted" :""?>"></span>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<?=$record_ipprotocol;?> <?=$record_ipprotocol;?>
<?php <?php
...@@ -479,30 +480,63 @@ $( document ).ready(function() { ...@@ -479,30 +480,63 @@ $( document ).ready(function() {
<?php <?php
endif;?> endif;?>
</td> </td>
<td> <td>
<?=htmlspecialchars(pprint_address($filterent['source']));?>
<?php if (isset($filterent['source']['address']) && is_alias($filterent['source']['address'])): ?> <?php if (isset($filterent['source']['address']) && is_alias($filterent['source']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['source']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($filterent['source']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($filterent['source']));?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['source']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($filterent['source']));?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port(isset($filterent['source']['port']) ? $filterent['source']['port'] : null)); ?> <?php if (isset($filterent['source']['port']) && is_alias($filterent['source']['port'])): ?>
<?php if (isset($filterent['source']['port']) && is_alias($filterent['source']['port'])): ?> <span title="<?=htmlspecialchars(get_alias_description($filterent['source']['port']));?>" data-toggle="tooltip">
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['source']['port']);?>"><i class="fa fa-list"></i> </a> <?=htmlspecialchars(pprint_port($filterent['source']['port'])); ?>&nbsp;
<?php endif; ?> </span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['source']['port']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_port(isset($filterent['source']['port']) ? $filterent['source']['port'] : null)); ?>
<?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($filterent['destination'])); ?>
<?php if (isset($filterent['destination']['address']) && is_alias($filterent['destination']['address'])): ?> <?php if (isset($filterent['destination']['address']) && is_alias($filterent['destination']['address'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['destination']['address']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($filterent['destination']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_address($filterent['destination'])); ?>
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['destination']['address']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_address($filterent['destination'])); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port(isset($filterent['destination']['port']) ? $filterent['destination']['port'] : null)); ?>
<?php if (isset($filterent['destination']['port']) && is_alias($filterent['destination']['port'])): ?> <?php if (isset($filterent['destination']['port']) && is_alias($filterent['destination']['port'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['destination']['port']);?>"><i class="fa fa-list"></i> </a> <span title="<?=htmlspecialchars(get_alias_description($filterent['destination']['port']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_port($filterent['destination']['port'])); ?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['destination']['port']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php else: ?>
<?=htmlspecialchars(pprint_port(isset($filterent['destination']['port']) ? $filterent['destination']['port'] : null)); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?php <?php
if (isset($filterent['gateway'])):?> if (isset($filterent['gateway'])):?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment