diff options
author | marcelloc <marcellocoutinho@gmail.com> | 2012-06-25 19:08:18 -0300 |
---|---|---|
committer | marcelloc <marcellocoutinho@gmail.com> | 2012-06-25 19:08:18 -0300 |
commit | 0f89c12522c4c51bae1399337156b94e29253046 (patch) | |
tree | 43cde75a972d846bbf8c2ab39d8b5364de748694 /usr/local/www/firewall_aliases.php | |
parent | 47c48e285b2a6d0e0eaf5c453d90a702eaea5dd4 (diff) | |
download | pfsense-0f89c12522c4c51bae1399337156b94e29253046.zip pfsense-0f89c12522c4c51bae1399337156b94e29253046.tar.gz |
firewall_aliases.php include tabs(ip,port,url) , list aliases sorted, use dom_title funcion to show titles.
Diffstat (limited to 'usr/local/www/firewall_aliases.php')
-rwxr-xr-x | usr/local/www/firewall_aliases.php | 156 |
1 files changed, 98 insertions, 58 deletions
diff --git a/usr/local/www/firewall_aliases.php b/usr/local/www/firewall_aliases.php index c7c935f..d48e978 100755 --- a/usr/local/www/firewall_aliases.php +++ b/usr/local/www/firewall_aliases.php @@ -163,76 +163,116 @@ include("head.inc"); <?php print_info_box_np(gettext("The alias list has been changed.") . "<br>" . gettext("You must apply the changes in order for them to take effect."));?> <?php endif; ?> <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases/pre_table"); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont"> -<tr> - <td width="25%" class="listhdrr"><?=gettext("Name"); ?></td> - <td width="25%" class="listhdrr"><?=gettext("Values"); ?></td> - <td width="25%" class="listhdr"><?=gettext("Description"); ?></td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> +<table width="100%" border="0" cellpadding="0" cellspacing="0" > +<tr><td class="tabnavtbl"> + <?php + $tab=($_REQUEST['tab'] == "" ? "ip" : preg_replace("/\W/","",$_REQUEST['tab'])); + $tab_array = array(); + $tab_array[] = array(gettext("IP"),($tab=="ip"? true : false), "/firewall_aliases.php?tab=ip"); + $tab_array[] = array(gettext("Ports"), ($tab=="port"? true : false), "/firewall_aliases.php?tab=port"); + $tab_array[] = array(gettext("Urls"), ($tab=="url"? true : false), "/firewall_aliases.php?tab=url"); + display_top_tabs($tab_array); + + ?> + </td></tr> + +<tr><td><div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="20%" class="listhdrr"><?=gettext("Name"); ?></td> + <td width="43%" class="listhdrr"><?=gettext("Values"); ?></td> + <td width="30%" class="listhdr"><?=gettext("Description"); ?></td> + <td width="7%" class="list"> + <table border="0" cellspacing="0" cellpadding="1"> <tr> <td valign="middle" width="17"> </td> - <td valign="middle"><a href="firewall_aliases_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new alias"); ?>"></a></td> + <td valign="middle"><a href="firewall_aliases_edit.php?tab=<?=$tab?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" <?=dom_title(gettext("Add a new alias"));?>></a></td> </tr> </table> </td> </tr> - <?php $i = 0; foreach ($a_aliases as $alias): ?> -<tr> - <td class="listlr" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> - <?=htmlspecialchars($alias['name']);?> - </td> - <td class="listr" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> - <?php - if ($alias["url"]) { - echo $alias["url"] . "<br/>"; - } - if ($alias["aliasurl"]) { - echo $alias["aliasurl"] . "<br/>"; - } - $tmpaddr = explode(" ", $alias['address']); - $addresses = implode(", ", array_slice($tmpaddr, 0, 10)); - echo $addresses; - if(count($tmpaddr) > 10) { - echo "..."; - } - ?> - </td> - <td class="listbg" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> - <?=htmlspecialchars($alias['descr']);?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="firewall_aliases_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit alias"); ?>"></a></td> - <td><a href="firewall_aliases.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this alias? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete alias"); ?>"></a></td> - </tr> - </table> - </td> -</tr> - <?php $i++; endforeach; ?> + <?php + asort($a_aliases); + foreach ($a_aliases as $i=> $alias){ + unset ($show_alias); + switch ($tab){ + case "ip": + if (preg_match("/(host|network)/",$alias["type"])) + $show_alias= true; + break; + case "url": + if (preg_match("/(url)/i",$alias["type"])) + $show_alias= true; + break; + case "port": + if($alias["type"] == "port") + $show_alias= true; + break; + } + if ($show_alias){?> + <tr> + <td class="listlr" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> + <?=htmlspecialchars($alias['name']);?> + </td> + <td class="listr" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> + <?php + if ($alias["url"]) { + echo $alias["url"] . "<br/>"; + } + if ($alias["aliasurl"]) { + echo $alias["aliasurl"] . "<br/>"; + } + $tmpaddr = explode(" ", $alias['address']); + $addresses = implode(", ", array_slice($tmpaddr, 0, 10)); + echo $addresses; + if(count($tmpaddr) > 10) { + echo "..."; + } + ?> + </td> + <td class="listbg" ondblclick="document.location='firewall_aliases_edit.php?id=<?=$i;?>';"> + <?=htmlspecialchars($alias['descr']);?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="firewall_aliases_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" <?=dom_title(gettext("Edit alias")." {$alias['name']}");?>></a></td> + <td><a href="firewall_aliases.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this alias? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" <?=dom_title(gettext("Delete alias")." {$alias['name']}");?>></a></td> + </tr> + </table> + </td> + </tr> + <?php + } + }?> + <tr> - <td class="list" colspan="3"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle" width="17"> </td> - <td valign="middle"> - <a href="firewall_aliases_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new alias"); ?>"></a></td> - </td> - <td valign="middle"> - <a href="firewall_aliases_import.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_import_alias.gif" width="17" height="17" border="0" title="<?=gettext("Bulk import aliases from list"); ?>" alt="" /></a> - </td> - </tr> - </table> - </td> + <td colspan="3"/> </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tbody> + <tr> + <td valign="middle"> + <a href="firewall_aliases_edit.php?tab=<?=$tab?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" <?=dom_title(gettext("Add a new alias")); ?>></a> + </td> + <td valign="middle"> + <a href="firewall_aliases_import.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_import_alias.gif" width="17" height="17" border="0" <?=dom_title(gettext("Bulk import aliases from list"));?> alt="" /></a> + </td> + </tr> + </tbody> + </table> + </td> </tr> -<tr> + <td class="tabcont" colspan="3"> - <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br></strong></span><?=gettext("Aliases act as placeholders for real hosts, networks or ports. They can be used to minimize the number of changes that have to be made if a host, network or port changes. You can enter the name of an alias instead of the host, network or port in all fields that have a red background. The alias will be resolved according to the list above. If an alias cannot be resolved (e.g. because you deleted it), the corresponding element (e.g. filter/NAT/shaper rule) will be considered invalid and skipped."); ?></span></p> + <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br></strong></span><div style="overflow:hidden; text-align:justify;"><?=gettext("Aliases act as placeholders for real hosts, networks or ports. They can be used to minimize the number of changes that have to be made if a host, network or port changes. You can enter the name of an alias instead of the host, network or port in all fields that have a red background. The alias will be resolved according to the list above. If an alias cannot be resolved (e.g. because you deleted it), the corresponding element (e.g. filter/NAT/shaper rule) will be considered invalid and skipped."); ?></div></span></p> </td> </tr> </table> + </div> + </td> + </tr> + </table> </form> <?php include("fend.inc"); ?> </body> |