Revision 4e8854c6
Added by Charlie Root about 13 years ago
usr/local/www/firewall_rules.php | ||
---|---|---|
294 | 294 |
$closehead = false; |
295 | 295 |
|
296 | 296 |
include("head.inc"); |
297 |
|
|
298 |
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>"; |
|
299 |
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>"; |
|
300 |
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>"; |
|
301 |
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>"; |
|
302 | 297 |
?> |
303 | 298 |
<link rel="stylesheet" href="/javascript/chosen/chosen.css" /> |
304 | 299 |
</head> |
... | ... | |
410 | 405 |
<tr valign="top" id="antilockout"> |
411 | 406 |
<td class="list"> </td> |
412 | 407 |
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0"></td> |
413 |
<td class="listlr" style="background-color: #E0E0E0"></td> |
|
408 |
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
|
414 | 409 |
<?php |
415 | 410 |
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout"); |
416 | 411 |
?> |
... | ... | |
421 | 416 |
<td class="listr" style="background-color: #E0E0E0"><?= $alports ?></td> |
422 | 417 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
423 | 418 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
424 |
<td class="listr" style="background-color: #E0E0E0"></td> |
|
419 |
<td class="listr" style="background-color: #E0E0E0"> </td>
|
|
425 | 420 |
<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td> |
426 | 421 |
<td valign="middle" nowrap class="list"> |
427 | 422 |
<table border="0" cellspacing="0" cellpadding="1"> |
... | ... | |
442 | 437 |
<tr valign="top" id="frrfc1918"> |
443 | 438 |
<td class="list"> </td> |
444 | 439 |
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> |
445 |
<td class="listlr" style="background-color: #E0E0E0"></td> |
|
440 |
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
|
446 | 441 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
447 | 442 |
<td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td> |
448 | 443 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
... | ... | |
450 | 445 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
451 | 446 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
452 | 447 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
453 |
<td class="listr" style="background-color: #E0E0E0"></td> |
|
448 |
<td class="listr" style="background-color: #E0E0E0"> </td>
|
|
454 | 449 |
<td class="listbg"><?=gettext("Block private networks");?></td> |
455 | 450 |
<td valign="middle" nowrap class="list"> |
456 | 451 |
<table border="0" cellspacing="0" cellpadding="1"> |
... | ... | |
470 | 465 |
<tr valign="top" id="frrfc1918"> |
471 | 466 |
<td class="list"> </td> |
472 | 467 |
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> |
473 |
<td class="listlr" style="background-color: #E0E0E0"></td> |
|
468 |
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
|
474 | 469 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
475 | 470 |
<td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td> |
476 | 471 |
<td class="listr" style="background-color: #E0E0E0">*</td> |
... | ... | |
697 | 692 |
} |
698 | 693 |
?> |
699 | 694 |
<td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> |
700 |
<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']; else echo ""; ?><?=$textse;?>
|
|
695 |
<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']." "; else echo " "; ?><?=$textse;?>
|
|
701 | 696 |
</td> |
702 | 697 |
<?php |
703 | 698 |
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr"); |
usr/local/www/guiconfig.inc | ||
---|---|---|
1014 | 1014 |
} |
1015 | 1015 |
} |
1016 | 1016 |
|
1017 |
function rule_popup($src,$srcport,$dst,$dstport){
|
|
1017 |
function alias_info_popup($alias_id){
|
|
1018 | 1018 |
global $config; |
1019 |
$maxlength = 60; |
|
1020 |
$close_title="title='".gettext('move mouse out this alias to hide')."'"; |
|
1021 |
if (is_array($config['aliases']['alias'][$alias_id])){ |
|
1022 |
$alias_name=$config['aliases']['alias'][$alias_id]; |
|
1023 |
$alias_objects_with_details = "<table width='100%' border='0' cellpadding='2' cellspacing='0'>"; |
|
1024 |
if ($alias_name['url']) { |
|
1025 |
exec("/sbin/pfctl -t {$alias_name['name']} -T show | wc -l", $total_entries); |
|
1026 |
$counter=preg_replace("/\D/","",$total_entries[0]); |
|
1027 |
exec("/sbin/pfctl -t {$alias_name['name']} -T show | head -10002", $alias_addresses); |
|
1028 |
$alias_objects_with_details .= "<tr><td colspan='3' $close_title class='vncell'>{$alias_name['url']}</td></tr>"; |
|
1029 |
$x=0; |
|
1030 |
foreach ($alias_addresses as $alias_ports_address ){ |
|
1031 |
switch ($x){ |
|
1032 |
case 0: |
|
1033 |
$x++; |
|
1034 |
$alias_objects_with_details .= "<tr><td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td>"; |
|
1035 |
break; |
|
1036 |
case 1: |
|
1037 |
$x++; |
|
1038 |
$alias_objects_with_details .= "<td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td>"; |
|
1039 |
break; |
|
1040 |
default: |
|
1041 |
$x=0; |
|
1042 |
$alias_objects_with_details .= "<td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td><tr>"; |
|
1043 |
break; |
|
1044 |
} |
|
1045 |
} |
|
1046 |
for ($y=$x;$y<=$x;$y++){ |
|
1047 |
$alias_objects_with_details .= "<td $close_title class='vncell' width='33%'> </td>"; |
|
1048 |
} |
|
1049 |
if ($x > 0) |
|
1050 |
$alias_objects_with_details .= "</tr>"; |
|
1051 |
if ($counter > 10002){ |
|
1052 |
$alias_objects_with_details .= "<tr><td colspan='3'> listing only first 10k items</td><tr>"; |
|
1053 |
} |
|
1054 |
} |
|
1055 |
else{ |
|
1056 |
$alias_addresses = explode (" ", $alias_name['address']); |
|
1057 |
$alias_details = explode ("||", $alias_name['detail']); |
|
1058 |
$counter=0; |
|
1059 |
foreach($alias_addresses as $alias_ports_address) |
|
1060 |
{ |
|
1061 |
$alias_objects_with_details .= "<tr><td $close_title width='5%' class='vncell' style='background: #FFFFFF;color: #000000;'>{$alias_addresses[$counter]}</td>"; |
|
1062 |
$alias_detail_default = strpos ($alias_details[$counter],"Entry added"); |
|
1063 |
if ($alias_details[$counter] != "" && $alias_detail_default === False) |
|
1064 |
$alias_objects_with_details .="<td $close_title width='95%' class='vncell' style='background: #FFFFFF;color: #000000;'>{$alias_details[$counter]}</td>"; |
|
1065 |
else |
|
1066 |
$alias_objects_with_details .="<td $close_title width='95%' class='vncell' style='background: #FFFFFF;color: #000000;'> </td>"; |
|
1067 |
$alias_objects_with_details .= "</tr>"; |
|
1068 |
$counter++; |
|
1069 |
} |
|
1070 |
|
|
1071 |
} |
|
1072 |
$alias_objects_with_details .="</table>"; |
|
1073 |
} |
|
1074 |
$alias_descr_substr = $alias_name['descr']; |
|
1075 |
if ($strlength >= $maxlength) |
|
1076 |
$alias_descr_substr = substr($alias_descr_substr, 0, $maxlength) . "..."; |
|
1077 |
$item_text=($counter > 1 ? "items" : "item"); |
|
1078 |
$alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}<a href='/firewall_aliases_edit.php?id={$alias_id}' title='".gettext('edit this alias')."'> edit </a>"; |
|
1079 |
$strlength = strlen ($alias_caption); |
|
1080 |
print "<h1>{$alias_caption}</h1>".$alias_objects_with_details; |
|
1081 |
} |
|
1082 |
|
|
1083 |
function rule_popup($src,$srcport,$dst,$dstport){ |
|
1084 |
global $config,$g; |
|
1019 | 1085 |
$aliases_array = array(); |
1020 | 1086 |
if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) |
1021 |
{ |
|
1022 |
$span_begin = ""; |
|
1023 |
$alias_src_span_begin = ""; |
|
1024 |
$alias_src_span_end = ""; |
|
1025 |
$alias_src_port_span_begin = ""; |
|
1026 |
$alias_src_port_span_end = ""; |
|
1027 |
$alias_dst_span_begin = ""; |
|
1028 |
$alias_dst_span_end = ""; |
|
1029 |
$alias_dst_port_span_begin = ""; |
|
1030 |
$alias_dst_port_span_end = ""; |
|
1031 |
$alias_content_text = ""; |
|
1032 |
foreach($config['aliases']['alias'] as $alias_name) |
|
1033 |
{ |
|
1034 |
$alias_addresses = explode (" ", $alias_name['address']); |
|
1035 |
$alias_details = explode ("||", $alias_name['detail']); |
|
1036 |
$alias_objects_with_details = ""; |
|
1037 |
$counter = 0; |
|
1038 |
if ($alias_name['url']) { |
|
1039 |
$alias_objects_with_details .= $alias_name['url'] . "<br/>"; |
|
1040 |
} |
|
1041 |
foreach($alias_addresses as $alias_ports_address) |
|
1042 |
{ |
|
1043 |
$alias_objects_with_details .= $alias_addresses[$counter]; |
|
1044 |
$alias_detail_default = strpos ($alias_details[$counter],"Entry added"); |
|
1045 |
if ($alias_details[$counter] != "" && $alias_detail_default === False){ |
|
1046 |
$alias_objects_with_details .=" - " . $alias_details[$counter]; |
|
1047 |
} |
|
1048 |
$alias_objects_with_details .= "<br>"; |
|
1049 |
$counter++; |
|
1050 |
} |
|
1051 |
//max character length for caption field |
|
1052 |
$maxlength = 60; |
|
1053 |
|
|
1054 |
$alias_descr_substr = $alias_name['descr']; |
|
1055 |
$alias_content_text = htmlspecialchars($alias_objects_with_details); |
|
1056 |
$alias_caption = htmlspecialchars($alias_descr_substr . ":"); |
|
1057 |
$strlength = strlen ($alias_caption); |
|
1058 |
if ($strlength >= $maxlength) |
|
1059 |
$alias_caption = substr($alias_caption, 0, $maxlength) . "..."; |
|
1060 |
|
|
1061 |
$alias_caption_escaped = str_replace("'", "\'", $alias_caption); |
|
1062 |
$alias_content_escaped = str_replace("'", "\'", $alias_content_text); |
|
1063 |
$span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$alias_caption_escaped</h1><p>$alias_content_escaped</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>"; |
|
1064 |
|
|
1065 |
if ($alias_name['name'] == $src) |
|
1066 |
$alias_src_span_begin = $span_begin; |
|
1067 |
if ($alias_name['name'] == $srcport) |
|
1068 |
$alias_src_port_span_begin = $span_begin; |
|
1069 |
if ($alias_name['name'] == $dst) |
|
1070 |
$alias_dst_span_begin = $span_begin; |
|
1071 |
if ($alias_name['name'] == $dstport) |
|
1072 |
$alias_dst_port_span_begin = $span_begin; |
|
1073 |
} |
|
1074 |
$descriptions = array (); |
|
1075 |
$descriptions['src'] = $alias_src_span_begin; |
|
1076 |
$descriptions['srcport'] = $alias_src_port_span_begin; |
|
1077 |
$descriptions['dst'] = $alias_dst_span_begin; |
|
1078 |
$descriptions['dstport'] = $alias_dst_port_span_begin; |
|
1079 |
|
|
1080 |
return $descriptions; |
|
1087 |
{ |
|
1088 |
$descriptions = array (); |
|
1089 |
foreach($config['aliases']['alias'] as $alias_id=>$alias_name){ |
|
1090 |
$loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\'> " .gettext("loading...")."</a>"; |
|
1091 |
switch ($alias_name['type']){ |
|
1092 |
case "port": |
|
1093 |
$width="250"; |
|
1094 |
break; |
|
1095 |
case "urltable": |
|
1096 |
$width="500"; |
|
1097 |
break; |
|
1098 |
default: |
|
1099 |
$width="350"; |
|
1100 |
break; |
|
1101 |
} |
|
1102 |
$span_begin = "<span style=\"cursor: help;\" onmouseover=\"var response_html=domTT_activate(this, event, 'id','ttalias_{$alias_id}','content','{$loading_image}', 'trail', true, 'delay', 300, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','type','velcro','width',{$width});alias_popup('{$alias_id}','{$g["theme"]}','".gettext('loading...')."');\" domTT_mouseout(this, close);\"><U>"; |
|
1103 |
if ($alias_name['name'] == $src) |
|
1104 |
$descriptions['src']= $span_begin; |
|
1105 |
if ($alias_name['name'] == $srcport) |
|
1106 |
$descriptions['srcport'] = $span_begin; |
|
1107 |
if ($alias_name['name'] == $dst ) |
|
1108 |
$descriptions['dst'] = $span_begin; |
|
1109 |
if ($alias_name['name'] == $dstport) |
|
1110 |
$descriptions['dstport'] = $span_begin; |
|
1111 |
} |
|
1112 |
return $descriptions; |
|
1081 | 1113 |
} |
1082 | 1114 |
} |
1083 | 1115 |
|
usr/local/www/index.php | ||
---|---|---|
58 | 58 |
require_once('notices.inc'); |
59 | 59 |
|
60 | 60 |
if(isset($_REQUEST['closenotice'])){ |
61 |
include("functions.inc"); |
|
62 | 61 |
close_notice($_REQUEST['closenotice']); |
63 | 62 |
echo get_menu_messages(); |
64 | 63 |
exit; |
65 | 64 |
} |
65 |
if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])){ |
|
66 |
alias_info_popup($_REQUEST['aliasid']); |
|
67 |
exit; |
|
68 |
} |
|
66 | 69 |
|
67 | 70 |
if($g['disablecrashreporter'] != true) { |
68 | 71 |
// Check to see if we have a crash report |
usr/local/www/javascript/ticker.js | ||
---|---|---|
1 | 1 |
/* $Id$ */ |
2 | 2 |
/* |
3 |
functions.inc
|
|
3 |
ticker.js
|
|
4 | 4 |
Copyright (C) 2012 Marcello Coutinho |
5 | 5 |
Copyright (C) 2012 Carlos Cesario - carloscesario@gmail.com |
6 | 6 |
All rights reserved. |
... | ... | |
57 | 57 |
jQuery(this).css('cursor','pointer'); |
58 | 58 |
}); |
59 | 59 |
}); |
60 |
|
|
61 |
function alias_popup(alias_id,theme,loading) { |
|
62 |
domTT_update('ttalias_'+alias_id,"<a><img src='/themes/"+theme+"/images/misc/loader.gif'>"+loading+"</a>"); |
|
63 |
jQuery.ajax({ |
|
64 |
type: 'post', |
|
65 |
cache: false, |
|
66 |
url: "/index.php", |
|
67 |
data: {aliasid:alias_id, act:'alias_info_popup'}, |
|
68 |
success: function(response) { |
|
69 |
//alert('<div>'+response.match(/<h1>.*<\/table>/i)+'<div>'); |
|
70 |
domTT_update('ttalias_'+alias_id,'<div>'+response.match(/<h1>.*<\/table>/i)+'<div>'); |
|
71 |
} |
|
72 |
}); |
|
73 |
} |
Also available in: Unified diff
improve alias popup in firewall_rules
include url_table list up to 10000 items
read alias only on mouseover
use table to list columns
show edit shortcut
show total items value on popup description