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) {
}
}
/* 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) {
if (is_subnetv4($subnet)) {
list ($ip, $bits) = explode("/", $subnet);
......
......@@ -323,36 +323,70 @@ $( document ).ready(function() {
<td>
<?=strtoupper($natent['protocol']);?>
</td>
<td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($natent['source']));?>
<?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; ?>
</td>
<td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port($natent['source']['port']));?>
<?php if (is_alias($natent['source']['port'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['port']);?>"><i class="fa fa-list"></i> </a>
<?php if (isset($natent['source']['port']) && is_alias($natent['source']['port'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($natent['source']['port']));?>" data-toggle="tooltip">
<?=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; ?>
</td>
<td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($natent['destination']));?>
<?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; ?>
</td>
<td class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_port($natent['destination']['port']));?>
<?php if (is_alias($natent['destination']['port'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['destination']['port']);?>"><i class="fa fa-list"></i> </a>
<?php if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($natent['destination']['port']));?>" data-toggle="tooltip">
<?=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; ?>
</td>
<td>
<?=$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>
<?php endif; ?>
</td>
<td>
<?php
$localport = $natent['local-port'];
......@@ -362,11 +396,19 @@ $( document ).ready(function() {
$localport .= '-' . $localendport;
}
?>
<?=htmlspecialchars(pprint_port($localport));?>
<?php if (is_alias($localport)): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($localport);?>"><i class="fa fa-list"></i> </a>
<?php if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($localport));?>" data-toggle="tooltip">
<?=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; ?>
</td>
<td>
<?=$natent['descr'];?>
</td>
......@@ -388,6 +430,7 @@ $( document ).ready(function() {
</tr>
<?php $nnats++; endforeach; ?>
<tr>
<td colspan="8"></td>
<td class="hidden-xs hidden-sm" colspan="4"> </td>
<td>
......
......@@ -231,15 +231,29 @@ $main_buttons = array(
<?php endif; ?>
</td>
<td>
<?=pprint_address($natent['source']);?>
<?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; ?>
</td>
<td>
<?=pprint_address($natent['destination']);?>
<?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; ?>
</td>
<td>
......
......@@ -363,10 +363,17 @@ include("head.inc");
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
</td>
<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'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['source']['network']);?>"><i class="fa fa-list"></i> </a>
<?php endif; ?>
<?php if (isset($natent['source']['network']) && is_alias($natent['source']['network'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($natent['source']['network']));?>" data-toggle="tooltip">
<?=htmlspecialchars($natent['source']['network']);?>&nbsp;
</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 class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
......@@ -374,10 +381,17 @@ include("head.inc");
</td>
<td class="hidden-xs hidden-sm">
<?=isset($natent['destination']['not']) ? "!&nbsp;" :"";?>
<?=isset($natent['destination']['any']) ? "*" : $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>
<?php endif; ?>
<?php if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($natent['destination']['address']));?>" data-toggle="tooltip">
<?=htmlspecialchars($natent['destination']['address']);?>&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: ?>
<?=isset($natent['destination']['any']) ? "*" : htmlspecialchars($natent['destination']['address']);?>
<?php endif; ?>
</td>
<td class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
......@@ -395,10 +409,17 @@ include("head.inc");
else
$nat_address = $natent['target'];
?>
<?=htmlspecialchars($nat_address);?>
<?php if (isset($natent['target']) && is_alias($natent['target'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['target']);?>"><i class="fa fa-list"></i> </a>
<?php endif; ?>
<?php if (isset($natent['target']) && is_alias($natent['target'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($natent['target']));?>" data-toggle="tooltip">
<?=htmlspecialchars($nat_address);?>&nbsp;
</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 class="hidden-xs hidden-sm">
<?=empty($natent['natport']) ? "*" : htmlspecialchars($natent['natport']);?>
......
......@@ -446,6 +446,7 @@ $( document ).ready(function() {
<span class="glyphicon glyphicon-info-sign <?=!empty($filterent['disabled']) ? "text-muted" :""?>"></span>
<?php endif; ?>
</td>
<td>
<?=$record_ipprotocol;?>
<?php
......@@ -479,30 +480,63 @@ $( document ).ready(function() {
<?php
endif;?>
</td>
<td>
<?=htmlspecialchars(pprint_address($filterent['source']));?>
<?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; ?>
</td>
<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'])): ?>
&nbsp;<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($filterent['source']['port']);?>"><i class="fa fa-list"></i> </a>
<?php endif; ?>
<?php if (isset($filterent['source']['port']) && is_alias($filterent['source']['port'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($filterent['source']['port']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_port($filterent['source']['port'])); ?>&nbsp;
</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 class="hidden-xs hidden-sm">
<?=htmlspecialchars(pprint_address($filterent['destination'])); ?>
<?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; ?>
</td>
<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'])): ?>
&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; ?>
</td>
<td class="hidden-xs hidden-sm">
<?php
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