diff options
author | Scott Dale <sdale@pfsense.org> | 2008-05-23 00:04:41 +0000 |
---|---|---|
committer | Scott Dale <sdale@pfsense.org> | 2008-05-23 00:04:41 +0000 |
commit | 2a9db752fb723b6c00ee8c15434ea5b011387940 (patch) | |
tree | 2a687ba44ea350346d1701da23d18a767682af26 /usr | |
parent | 1d622048193b2e330e4488379fe4c90d5ad08eb7 (diff) | |
download | pfsense-2a9db752fb723b6c00ee8c15434ea5b011387940.zip pfsense-2a9db752fb723b6c00ee8c15434ea5b011387940.tar.gz |
Move alias popup to function. Display Alias popup for NATs now.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/firewall_nat.php | 36 | ||||
-rwxr-xr-x | usr/local/www/firewall_rules.php | 80 |
2 files changed, 44 insertions, 72 deletions
diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php index 6991283..6f5f671 100755 --- a/usr/local/www/firewall_nat.php +++ b/usr/local/www/firewall_nat.php @@ -135,6 +135,11 @@ if (isset($_POST['del_x'])) { $pgtitle = array("Firewall","NAT","Port Forward"); include("head.inc"); +echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>"; +echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>"; +echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>"; +echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>"; + ?> <body link="#000000" vlink="#000000" alink="#000000"> <?php include("fbegin.inc"); ?> @@ -183,6 +188,29 @@ include("head.inc"); </tr> <?php $nnats = $i = 0; foreach ($a_nat as $natent): ?> <?php + + //build Alias popup box + $span_begin = ""; + $span_end = ""; + $alias_src_port_span_begin = ""; + $alias_dst_span_begin = ""; + $alias_dst_port_span_begin = ""; + + list($beginport, $endport) = split("-", $natent['external-port']); + + $alias_popup = rule_popup("",$beginport,$natent['target'],$natent['local-port']); + $span_end = "</U></span>"; + + + $alias_src_port_span_begin = $alias_popup["srcport"]; + + $alias_dst_span_begin = $alias_popup["dst"]; + + $alias_dst_port_span_begin = $alias_popup["dstport"]; + + + + /* if user does not have access to edit an interface skip on to the next record */ if(!have_natpfruleint_access($natent['interface'])) continue; @@ -207,17 +235,19 @@ include("head.inc"); <?php list($beginport, $endport) = split("-", $natent['external-port']); if ((!$endport) || ($beginport == $endport)) { + echo $alias_src_port_span_begin; echo $beginport; if ($wkports[$beginport]) echo " (" . $wkports[$beginport] . ")"; else echo " "; + echo $span_end; } else echo $beginport . " - " . $endport; ?> </td> <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';"> - <?=$natent['target'];?> + <?php echo $alias_dst_span_begin;?><?=$natent['target'];?><?php echo $span_end;?> <?php if ($natent['external-address']) echo "<br>(ext.: " . $natent['external-address'] . ")"; else @@ -226,11 +256,13 @@ include("head.inc"); </td> <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';"> <?php if ((!$endport) || ($beginport == $endport)) { - echo $natent['local-port']; + echo $alias_dst_port_span_begin; + echo $natent['local-port']; if ($wkports[$natent['local-port']]) echo " (" . $wkports[$natent['local-port']] . ")"; else echo " "; + echo $span_end; } else echo $natent['local-port'] . " - " . ($natent['local-port']+$endport-$beginport); diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index ecb0295..b9a5ebf 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -208,30 +208,6 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript <?php if (file_exists($d_filterconfdirty_path)): ?><p> <?php print_info_box_np("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br> <?php endif; ?> -<?php - $aliases_array = array(); - if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) - { - foreach($config['aliases']['alias'] as $alias_name) - { - $alias_addresses = explode (" ", $alias_name['address']); - $alias_details = explode ("||", $alias_name['detail']); - $alias_objects_with_details = ""; - $counter = 0; - foreach($alias_addresses as $alias_ports_address) - { - $alias_objects_with_details .= $alias_addresses[$counter]; - $alias_detail_default = strpos ($alias_details[$counter],"Entry added"); - if ($alias_details[$counter] != "" && $alias_detail_default === False){ - $alias_objects_with_details .=" - " . $alias_details[$counter]; - } - $alias_objects_with_details .= "<br>"; - $counter++; - } - $aliases_array[] = array($alias_name['name'], $alias_name['descr'], $alias_objects_with_details); - } - } -?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php @@ -382,61 +358,25 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript <?php endif; ?> </td> <?php + //build Alias popup box - $span_begin = ""; $span_end = ""; $alias_src_span_begin = ""; - $alias_src_span_end = ""; $alias_src_port_span_begin = ""; - $alias_src_port_span_end = ""; $alias_dst_span_begin = ""; - $alias_dst_span_end = ""; $alias_dst_port_span_begin = ""; - $alias_dst_port_span_end = ""; - $alias_content_text = ""; - //max character length for caption field - $maxlength = 60; - foreach ($aliases_array as $alias) - { - $alias_id_substr = $alias[0]; - $alias_descr_substr = $alias[1]; - $alias_content_text = htmlspecialchars($alias[2]); - $alias_caption = htmlspecialchars($alias_descr_substr . ":"); - $strlength = strlen ($alias_caption); - if ($strlength >= $maxlength) - $alias_caption = substr($alias_caption, 0, $maxlength) . "..."; - - $alias_check_src = $filterent['source']['address']; - $alias_check_srcport = pprint_port($filterent['source']['port']); - $alias_check_dst = $filterent['destination']['address']; - $alias_check_dstport = pprint_port($filterent['destination']['port']); + $alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port'])); + $span_end = "</U></span>"; - $span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$alias_caption</h1><p>$alias_content_text</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>"; - $span_end = "</U></span>"; + $alias_src_span_begin = $alias_popup["src"]; + + $alias_src_port_span_begin = $alias_popup["srcport"]; + + $alias_dst_span_begin = $alias_popup["dst"]; + + $alias_dst_port_span_begin = $alias_popup["dstport"]; - if ($alias_id_substr == $alias_check_src) - { - $alias_src_span_begin = $span_begin; - $alias_src_span_end = $span_end; - } - if ($alias_id_substr == $alias_check_srcport) - { - $alias_src_port_span_begin = $span_begin; - $alias_src_port_span_end = $span_end; - } - if ($alias_id_substr == $alias_check_dst) - { - $alias_dst_span_begin = $span_begin; - $alias_dst_span_end = $span_end; - } - if ($alias_id_substr == $alias_check_dstport) - { - $alias_dst_port_span_begin = $span_begin; - $alias_dst_port_span_end = $span_end; - } - } - //build Schedule popup box $a_schedules = &$config['schedules']['schedule']; $schedule_span_begin = ""; |