Revision d329d587
Added by Darren Embry almost 13 years ago
usr/local/www/guiconfig.inc | ||
---|---|---|
1027 | 1027 |
exec("/sbin/pfctl -t {$alias_name['name']} -T show | head -10002", $alias_addresses); |
1028 | 1028 |
$alias_objects_with_details .= "<tr><td colspan='3' $close_title class='vncell'>{$alias_name['url']}</td></tr>"; |
1029 | 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>"; |
|
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; |
|
1053 | 1044 |
} |
1054 | 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 |
} |
|
1052 |
if ($counter > 10002) { |
|
1053 |
$alias_objects_with_details .= "<tr><td colspan='3'> listing only first 10k items</td><tr>"; |
|
1054 |
} |
|
1055 |
} |
|
1055 | 1056 |
else{ |
1056 | 1057 |
$alias_addresses = explode (" ", $alias_name['address']); |
1057 | 1058 |
$alias_details = explode ("||", $alias_name['detail']); |
1058 |
$counter=0; |
|
1059 |
foreach($alias_addresses as $alias_ports_address) |
|
1060 |
{ |
|
1059 |
$counter = 0; |
|
1060 |
foreach ($alias_addresses as $alias_ports_address) { |
|
1061 | 1061 |
$alias_objects_with_details .= "<tr><td $close_title width='5%' class='vncell' style='background: #FFFFFF;color: #000000;'>{$alias_addresses[$counter]}</td>"; |
1062 | 1062 |
$alias_detail_default = strpos ($alias_details[$counter],"Entry added"); |
1063 | 1063 |
if ($alias_details[$counter] != "" && $alias_detail_default === False) |
... | ... | |
1066 | 1066 |
$alias_objects_with_details .="<td $close_title width='95%' class='vncell' style='background: #FFFFFF;color: #000000;'> </td>"; |
1067 | 1067 |
$alias_objects_with_details .= "</tr>"; |
1068 | 1068 |
$counter++; |
1069 |
} |
|
1070 |
|
|
1071 |
} |
|
1072 |
$alias_objects_with_details .="</table>"; |
|
1069 |
} |
|
1073 | 1070 |
} |
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; |
|
1071 |
$alias_objects_with_details .= "</table>"; |
|
1072 |
} |
|
1073 |
$alias_descr_substr = $alias_name['descr']; |
|
1074 |
if ($strlength >= $maxlength) |
|
1075 |
$alias_descr_substr = substr($alias_descr_substr, 0, $maxlength) . "..."; |
|
1076 |
$item_text = ($counter > 1 ? "items" : "item"); |
|
1077 |
$alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}<a href='/firewall_aliases_edit.php?id={$alias_id}' title='".gettext('edit this alias')."'> edit </a>"; |
|
1078 |
$strlength = strlen ($alias_caption); |
|
1079 |
print "<h1>{$alias_caption}</h1>" . $alias_objects_with_details; |
|
1081 | 1080 |
} |
1082 | 1081 |
|
1083 | 1082 |
function rule_popup($src,$srcport,$dst,$dstport){ |
1084 | 1083 |
global $config,$g; |
1085 | 1084 |
$aliases_array = array(); |
1086 |
if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) |
|
1087 |
{ |
|
1085 |
if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) { |
|
1088 | 1086 |
$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...')."');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><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;
|
|
1087 |
foreach ($config['aliases']['alias'] as $alias_id=>$alias_name){
|
|
1088 |
$loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\'> " .gettext("loading...")."</a>"; |
|
1089 |
switch ($alias_name['type']){ |
|
1090 |
case "port": |
|
1091 |
$width="250"; |
|
1092 |
break; |
|
1093 |
case "urltable": |
|
1094 |
$width="500"; |
|
1095 |
break; |
|
1096 |
default: |
|
1097 |
$width="350"; |
|
1098 |
break; |
|
1099 |
} |
|
1100 |
$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...')."');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>"; |
|
1101 |
if ($alias_name['name'] == $src) |
|
1102 |
$descriptions['src']= $span_begin;
|
|
1103 |
if ($alias_name['name'] == $srcport)
|
|
1104 |
$descriptions['srcport'] = $span_begin;
|
|
1105 |
if ($alias_name['name'] == $dst )
|
|
1106 |
$descriptions['dst'] = $span_begin;
|
|
1107 |
if ($alias_name['name'] == $dstport)
|
|
1108 |
$descriptions['dstport'] = $span_begin;
|
|
1109 |
} |
|
1110 |
return $descriptions;
|
|
1113 | 1111 |
} |
1114 | 1112 |
} |
1115 | 1113 |
|
Also available in: Unified diff
a few coding indentation/style fixes.