diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 5656de8637..dd6c90ffef 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -294,11 +294,6 @@ if (isset($_POST['del_x'])) { $closehead = false; include("head.inc"); - -echo ""; -echo ""; -echo ""; -echo ""; ?> @@ -410,7 +405,7 @@ if($_REQUEST['undodrag']) {   - +   @@ -421,7 +416,7 @@ if($_REQUEST['undodrag']) { * * - +   @@ -442,7 +437,7 @@ if($_REQUEST['undodrag']) { - + @@ -450,7 +445,7 @@ if($_REQUEST['undodrag']) { - +
    * ** * *  @@ -470,7 +465,7 @@ if($_REQUEST['undodrag']) { - + @@ -697,7 +692,7 @@ if($_REQUEST['undodrag']) { } ?> "; + if ($alias_name['url']) { + exec("/sbin/pfctl -t {$alias_name['name']} -T show | wc -l", $total_entries); + $counter=preg_replace("/\D/","",$total_entries[0]); + exec("/sbin/pfctl -t {$alias_name['name']} -T show | head -10002", $alias_addresses); + $alias_objects_with_details .= ""; + $x=0; + foreach ($alias_addresses as $alias_ports_address ){ + switch ($x){ + case 0: + $x++; + $alias_objects_with_details .= ""; + break; + case 1: + $x++; + $alias_objects_with_details .= ""; + break; + default: + $x=0; + $alias_objects_with_details .= ""; + break; + } + } + for ($y=$x;$y<=$x;$y++){ + $alias_objects_with_details .= ""; + } + if ($x > 0) + $alias_objects_with_details .= ""; + if ($counter > 10002){ + $alias_objects_with_details .= ""; + } + } + else{ + $alias_addresses = explode (" ", $alias_name['address']); + $alias_details = explode ("||", $alias_name['detail']); + $counter=0; + foreach($alias_addresses as $alias_ports_address) + { + $alias_objects_with_details .= ""; + $alias_detail_default = strpos ($alias_details[$counter],"Entry added"); + if ($alias_details[$counter] != "" && $alias_detail_default === False) + $alias_objects_with_details .=""; + else + $alias_objects_with_details .=""; + $alias_objects_with_details .= ""; + $counter++; + } + + } + $alias_objects_with_details .="
    * * - +
{$alias_name['url']}
{$alias_ports_address}{$alias_ports_address}{$alias_ports_address}
 
listing only first 10k items
{$alias_addresses[$counter]}{$alias_details[$counter]} 
"; + } + $alias_descr_substr = $alias_name['descr']; + if ($strlength >= $maxlength) + $alias_descr_substr = substr($alias_descr_substr, 0, $maxlength) . "..."; + $item_text=($counter > 1 ? "items" : "item"); + $alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}  edit "; + $strlength = strlen ($alias_caption); + print "

{$alias_caption}

".$alias_objects_with_details; +} + +function rule_popup($src,$srcport,$dst,$dstport){ + global $config,$g; $aliases_array = array(); if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) - { - $span_begin = ""; - $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 = ""; - 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; - if ($alias_name['url']) { - $alias_objects_with_details .= $alias_name['url'] . "
"; - } - 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 .= "
"; - $counter++; - } - //max character length for caption field - $maxlength = 60; - - $alias_descr_substr = $alias_name['descr']; - $alias_content_text = htmlspecialchars($alias_objects_with_details); - $alias_caption = htmlspecialchars($alias_descr_substr . ":"); - $strlength = strlen ($alias_caption); - if ($strlength >= $maxlength) - $alias_caption = substr($alias_caption, 0, $maxlength) . "..."; - - $alias_caption_escaped = str_replace("'", "\'", $alias_caption); - $alias_content_escaped = str_replace("'", "\'", $alias_content_text); - $span_begin = "$alias_caption_escaped

$alias_content_escaped

', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\">"; - - if ($alias_name['name'] == $src) - $alias_src_span_begin = $span_begin; - if ($alias_name['name'] == $srcport) - $alias_src_port_span_begin = $span_begin; - if ($alias_name['name'] == $dst) - $alias_dst_span_begin = $span_begin; - if ($alias_name['name'] == $dstport) - $alias_dst_port_span_begin = $span_begin; - } - $descriptions = array (); - $descriptions['src'] = $alias_src_span_begin; - $descriptions['srcport'] = $alias_src_port_span_begin; - $descriptions['dst'] = $alias_dst_span_begin; - $descriptions['dstport'] = $alias_dst_port_span_begin; - - return $descriptions; + { + $descriptions = array (); + foreach($config['aliases']['alias'] as $alias_id=>$alias_name){ + $loading_image=" " .gettext("loading...").""; + switch ($alias_name['type']){ + case "port": + $width="250"; + break; + case "urltable": + $width="500"; + break; + default: + $width="350"; + break; + } + $span_begin = ""; + if ($alias_name['name'] == $src) + $descriptions['src']= $span_begin; + if ($alias_name['name'] == $srcport) + $descriptions['srcport'] = $span_begin; + if ($alias_name['name'] == $dst ) + $descriptions['dst'] = $span_begin; + if ($alias_name['name'] == $dstport) + $descriptions['dstport'] = $span_begin; + } + return $descriptions; } } diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 9b19a48935..1287672e4e 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -58,11 +58,14 @@ require_once('guiconfig.inc'); require_once('notices.inc'); if(isset($_REQUEST['closenotice'])){ - include("functions.inc"); close_notice($_REQUEST['closenotice']); echo get_menu_messages(); exit; } +if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])){ + alias_info_popup($_REQUEST['aliasid']); + exit; +} if($g['disablecrashreporter'] != true) { // Check to see if we have a crash report diff --git a/usr/local/www/javascript/ticker.js b/usr/local/www/javascript/ticker.js index 3c8b6ccd35..defb1d84d4 100755 --- a/usr/local/www/javascript/ticker.js +++ b/usr/local/www/javascript/ticker.js @@ -1,6 +1,6 @@ /* $Id$ */ /* - functions.inc + ticker.js Copyright (C) 2012 Marcello Coutinho Copyright (C) 2012 Carlos Cesario - carloscesario@gmail.com All rights reserved. @@ -57,3 +57,17 @@ jQuery(document).ready(function() { jQuery(this).css('cursor','pointer'); }); }); + +function alias_popup(alias_id,theme,loading) { + domTT_update('ttalias_'+alias_id,""+loading+""); + jQuery.ajax({ + type: 'post', + cache: false, + url: "/index.php", + data: {aliasid:alias_id, act:'alias_info_popup'}, + success: function(response) { + //alert('
'+response.match(/

.*<\/table>/i)+'
'); + domTT_update('ttalias_'+alias_id,'
'+response.match(/

.*<\/table>/i)+'
'); + } + }); +} \ No newline at end of file