diff options
Diffstat (limited to 'usr/local/www')
25 files changed, 1072 insertions, 944 deletions
diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php index f79efce..796e8e4 100755 --- a/usr/local/www/diag_arp.php +++ b/usr/local/www/diag_arp.php @@ -321,14 +321,15 @@ $mac_man = load_mac_manufacturer_table(); <td class="listlr"><?=$entry['ip'];?></td> <td class="listr"> <?php - $mac=$entry['mac']; + $mac=trim($entry['mac']); $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); print $mac; if(isset($mac_man[$mac_hi])){ print "<br/><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; } ?> + </td> <td class="listr"> <?php - echo str_replace("Z_ ", "", $entry['dnsresolve']); + echo trim(str_replace("Z_ ", "", $entry['dnsresolve'])); ?> </td> <td class="listr"><?=$hwif[$entry['interface']];?></td> diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index d7efdcc..a84810e 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -61,7 +61,7 @@ if ($_POST || $_REQUEST['host']) { if (!$input_errors) { $do_ping = true; - $host = $_REQUEST['host']; + $host = trim($_REQUEST['host']); $interface = $_REQUEST['interface']; $count = $_POST['count']; if (preg_match('/[^0-9]/', $count) ) diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 4bc14dc..60bc031 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -3,7 +3,7 @@ /* firewall_rules.php part of pfSense (http://www.pfsense.com) - Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com) + Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com) originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. @@ -109,14 +109,14 @@ if($_REQUEST['dragdroporder']) { // Redirect back to page mark_subsystem_dirty('filter'); $undo = array(); - foreach($_REQUEST['dragtable'] as $dt) + foreach($_REQUEST['dragtable'] as $dt) $undo[] = ""; $counter = 0; foreach($_REQUEST['dragtable'] as $dt) { $undo[$dt] = $counter; $counter++; } - foreach($undo as $dt) + foreach($undo as $dt) $undotxt .= "&dragtable[]={$dt}"; Header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt); exit; @@ -149,15 +149,15 @@ if (is_array($config['ifgroups']['ifgroupentry'])) $iflist[$ifgen['ifname']] = $ifgen['ifname']; foreach ($ifdescs as $ifent => $ifdesc) - if(have_ruleint_access($ifent)) + if(have_ruleint_access($ifent)) $iflist[$ifent] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) - $iflist['l2tp'] = "L2TP VPN"; + if(have_ruleint_access("l2tp")) + $iflist['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if(have_ruleint_access("pptp")) $iflist['pptp'] = "PPTP VPN"; if (is_array($config['pppoes']['pppoe'])) { @@ -168,19 +168,19 @@ if (is_array($config['pppoes']['pppoe'])) { /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if(have_ruleint_access("enc0")) $iflist["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) - $iflist["openvpn"] = "OpenVPN"; + $iflist["openvpn"] = "OpenVPN"; pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override"); if (!$if || !isset($iflist[$if])) { if ("any" == $if) - $if = "FloatingRules"; - else if ("FloatingRules" != $if) { + $if = "FloatingRules"; + else if ("FloatingRules" != $if) { if (isset($iflist['wan'])) $if = "wan"; else @@ -218,7 +218,7 @@ if ($_GET['act'] == "del") { } // Handle save msg if defined -if($_REQUEST['savemsg']) +if($_REQUEST['savemsg']) $savemsg = htmlentities($_REQUEST['savemsg']); if (isset($_POST['del_x'])) { @@ -235,10 +235,10 @@ if (isset($_POST['del_x'])) { } } else if ($_GET['act'] == "toggle") { if ($a_filter[$_GET['id']]) { - if(isset($a_filter[$_GET['id']]['disabled'])) - unset($a_filter[$_GET['id']]['disabled']); - else - $a_filter[$_GET['id']]['disabled'] = true; + if(isset($a_filter[$_GET['id']]['disabled'])) + unset($a_filter[$_GET['id']]['disabled']); + else + $a_filter[$_GET['id']]['disabled'] = true; if (write_config()) mark_subsystem_dirty('filter'); header("Location: firewall_rules.php?if=" . htmlspecialchars($if)); @@ -307,7 +307,7 @@ include("head.inc"); <?php if (is_subsystem_dirty('filter')): ?><p> <?php if($_REQUEST['undodrag']) { - foreach($_REQUEST['dragtable'] as $dt) + foreach($_REQUEST['dragtable'] as $dt) $dragtable .= "&dragtable[]={$dt}"; print_info_box_np_undo(gettext("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect."), "apply" , gettext("Apply changes") , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}"); } else { @@ -324,15 +324,15 @@ if($_REQUEST['undodrag']) { pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> - <?php + <tr><td class="tabnavtbl"> + <?php /* active tabs */ $tab_array = array(); - if ("FloatingRules" == $if) - $active = true; - else - $active = false; - $tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules"); + if ("FloatingRules" == $if) + $active = true; + else + $active = false; + $tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules"); $tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) { if ($ifent == $if) $active = true; @@ -341,22 +341,21 @@ if($_REQUEST['undodrag']) { $tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}"); } display_top_tabs($tab_array); - ?> - </td></tr> - <tr> - <td> - <div id="mainarea"> + ?> + </td></tr> + <tr><td> + <div id="mainarea"> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> -<?php - pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr"); -?> + <?php + pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr"); + ?> <tr id="frheader"> <td width="3%" class="list"> </td> <td width="5%" class="list"> </td> <td width="3%" class="listhdrr"><?=gettext("ID");?></td> -<?php + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead"); -?> + ?> <td width="6%" class="listhdrr"><?=gettext("Proto");?></td> <td width="12%" class="listhdrr"><?=gettext("Source");?></td> <td width="6%" class="listhdrr"><?=gettext("Port");?></td> @@ -365,48 +364,49 @@ if($_REQUEST['undodrag']) { <td width="5%" class="listhdrr"><?=gettext("Gateway");?></td> <td width="8%" class="listhdrr"><?=gettext("Queue");?></td> <td width="5%" class="listhdrr"><?=gettext("Schedule");?></td> -<?php + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead"); -?> + ?> <td width="19%" class="listhdr"><?=gettext("Description");?></td> <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <?php - $nrules = 0; - for ($i = 0; isset($a_filter[$i]); $i++) { - $filterent = $a_filter[$i]; - if ($filterent['interface'] != $if && !isset($filterent['floating'])) - continue; - if (isset($filterent['floating']) && "FloatingRules" != $if) - continue; - $nrules++; - } - ?> - <td> - <?php if ($nrules == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?gettext("delete selected rules"); ?>" border="0"><?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"><?php endif; ?> - </td> - <td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> -<?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1. - if (!isset($config['system']['webgui']['noantilockout']) && - (((count($config['interfaces']) > 1) && ($if == 'lan')) - || ((count($config['interfaces']) == 1) && ($if == 'wan')))): - - $alports = implode('<br/>', filter_get_antilockout_ports(true)); -?> - <tr valign="top" id="antilockout"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <?php + $nrules = 0; + for ($i = 0; isset($a_filter[$i]); $i++) { + $filterent = $a_filter[$i]; + if ($filterent['interface'] != $if && !isset($filterent['floating'])) + continue; + if (isset($filterent['floating']) && "FloatingRules" != $if) + continue; + $nrules++; + } + ?> + <td> + <?php if ($nrules == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?gettext("delete selected rules"); ?>" border="0"><?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"> + <?php endif; ?> + </td> + <td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1. + if (!isset($config['system']['webgui']['noantilockout']) && + (((count($config['interfaces']) > 1) && ($if == 'lan')) + || ((count($config['interfaces']) == 1) && ($if == 'wan')))): + + $alports = implode('<br/>', filter_get_antilockout_ports(true)); + ?> + <tr valign="top" id="antilockout"> <td class="list"> </td> <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0"></td> <td class="listlr" style="background-color: #E0E0E0"> </td> -<?php + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout"); -?> + ?> <td class="listr" style="background-color: #E0E0E0">*</td> <td class="listr" style="background-color: #E0E0E0">*</td> <td class="listr" style="background-color: #E0E0E0">*</td> @@ -432,124 +432,126 @@ if($_REQUEST['undodrag']) { <?php endif; ?> <?php if (isset($config['interfaces'][$if]['blockpriv'])): ?> - <tr valign="top" id="frrfc1918"> - <td class="list"> </td> - <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> - <td class="listlr" style="background-color: #E0E0E0"> </td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0"> </td> - <td class="listbg"><?=gettext("Block private networks");?></td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> + <tr valign="top" id="frrfc1918"> + <td class="list"> </td> + <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> + <td class="listlr" style="background-color: #E0E0E0"> </td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0"> </td> + <td class="listbg"><?=gettext("Block private networks");?></td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td> - <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td> + <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td> </tr> <tr> - <td align="center" valign="middle"></td> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td> + <td align="center" valign="middle"></td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td> </tr> - </table> - </td> - </tr> + </table> + </td> + </tr> <?php endif; ?> <?php if (isset($config['interfaces'][$if]['blockbogons'])): ?> - <tr valign="top" id="frrfc1918"> - <td class="list"> </td> - <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> - <td class="listlr" style="background-color: #E0E0E0"> </td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listr" style="background-color: #E0E0E0">*</td> - <td class="listbg"><?=gettext("Block bogon networks");?></td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> + <tr valign="top" id="frrfc1918"> + <td class="list"> </td> + <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td> + <td class="listlr" style="background-color: #E0E0E0"> </td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listr" style="background-color: #E0E0E0">*</td> + <td class="listbg"><?=gettext("Block bogon networks");?></td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td> - <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td> + <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td> </tr> <tr> - <td align="center" valign="middle"></td> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td> + <td align="center" valign="middle"></td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td> </tr> - </table> - </td> - </tr> + </table> + </td> + </tr> <?php endif; ?> - <tbody id="dragtable" width="100%"> - <?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): - pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start"); - $filterent = $a_filter[$i]; - if ($filterent['interface'] != $if && !isset($filterent['floating'])) - continue; - if (isset($filterent['floating']) && "FloatingRules" != $if) - continue; - $isadvset = firewall_check_for_advanced_options($filterent); - if($isadvset) - $advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\">"; - else - $advanced_set = ""; - ?> - <tr valign="top" id="fr<?=$nrules;?>"> - <td class="listt"> - <input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"> - <?php echo $advanced_set; ?> - </td> - <td class="listt" align="center"> - <?php if ($filterent['type'] == "block") - $iconfn = "block"; - else if ($filterent['type'] == "reject") { - $iconfn = "reject"; - } else - $iconfn = "pass"; - if (isset($filterent['disabled'])) { - $textss = "<span class=\"gray\">"; - $textse = "</span>"; - $iconfn .= "_d"; - } else { - $textss = $textse = ""; - } - ?> - <a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("click to toggle enabled/disabled status");?>"></a> - <?php if (isset($filterent['log'])): - $iconfnlog = "log_s"; - if (isset($filterent['disabled'])) - $iconfnlog .= "_d"; - ?> - <br><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0"> - <?php endif; ?> - </td> - <?php - + <tbody id="dragtable" width="100%"> +<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): + pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start"); + $filterent = $a_filter[$i]; + if ($filterent['interface'] != $if && !isset($filterent['floating'])) + continue; + if (isset($filterent['floating']) && "FloatingRules" != $if) + continue; + $isadvset = firewall_check_for_advanced_options($filterent); + if($isadvset) + $advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\">"; + else + $advanced_set = ""; +?> + <tr valign="top" id="fr<?=$nrules;?>"> + <td class="listt"> + <input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"> + <?php echo $advanced_set; ?> + </td> + <td class="listt" align="center"> + <?php + if ($filterent['type'] == "block") + $iconfn = "block"; + else if ($filterent['type'] == "reject") + $iconfn = "reject"; + else + $iconfn = "pass"; + if (isset($filterent['disabled'])) { + $textss = "<span class=\"gray\">"; + $textse = "</span>"; + $iconfn .= "_d"; + } else { + $textss = $textse = ""; + } + ?> + <a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("click to toggle enabled/disabled status");?>"></a> + <?php + if (isset($filterent['log'])): + $iconfnlog = "log_s"; + if (isset($filterent['disabled'])) + $iconfnlog .= "_d"; + ?> + <br><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0"> +<?php endif; ?> + </td> + <?php + //build Alias popup box $alias_src_span_begin = ""; $alias_src_port_span_begin = ""; $alias_dst_span_begin = ""; $alias_dst_port_span_begin = ""; - + $alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port'])); - + $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"]; - + $alias_src_span_end = $alias_popup["src_end"]; $alias_src_port_span_end = $alias_popup["srcport_end"]; $alias_dst_span_end = $alias_popup["dst_end"]; $alias_dst_port_span_end = $alias_popup["dstport_end"]; - + //build Schedule popup box $a_schedules = &$config['schedules']['schedule']; $schedule_span_begin = ""; @@ -564,22 +566,22 @@ if($_REQUEST['undodrag']) { { if ($schedule['name'] == $filterent['sched'] ){ $schedstatus = filter_get_time_based_rule_status($schedule); - + foreach($schedule['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; $firstprint = false; if ($timerange){ $dayFriendly = ""; - $tempFriendlyTime = ""; - + $tempFriendlyTime = ""; + //get hours $temptimerange = $timerange['hour']; $temptimeseparator = strrpos($temptimerange, "-"); - - $starttime = substr ($temptimerange, 0, $temptimeseparator); - $stoptime = substr ($temptimerange, $temptimeseparator+1); - + + $starttime = substr ($temptimerange, 0, $temptimeseparator); + $stoptime = substr ($temptimerange, $temptimeseparator+1); + if ($timerange['month']){ $tempmontharray = explode(",", $timerange['month']); $tempdayarray = explode(",",$timerange['day']); @@ -589,14 +591,14 @@ if($_REQUEST['undodrag']) { foreach ($tempmontharray as $monthtmp){ $month = $tempmontharray[$arraycounter]; $day = $tempdayarray[$arraycounter]; - + if (!$firstDayFound) { $firstDay = $day; $firstmonth = $month; $firstDayFound = true; } - + $currentDay = $day; $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; @@ -608,21 +610,21 @@ if($_REQUEST['undodrag']) { $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; else $dayFriendly .= $monthArray[$month-1] . " " . $day; - $firstDayFound = false; + $firstDayFound = false; $firstPrint = true; - } - $arraycounter++; + } + $arraycounter++; } } else { $tempdayFriendly = $timerange['position']; $firstDayFound = false; - $tempFriendlyDayArray = explode(",", $tempdayFriendly); + $tempFriendlyDayArray = explode(",", $tempdayFriendly); $currentDay = ""; $firstDay = ""; $nextDay = ""; - $counter = 0; + $counter = 0; foreach ($tempFriendlyDayArray as $day){ if ($day != ""){ if (!$firstDayFound) @@ -633,7 +635,7 @@ if($_REQUEST['undodrag']) { $currentDay =$tempFriendlyDayArray[$counter]; //get next day $nextDay = $tempFriendlyDayArray[$counter+1]; - $currentDay++; + $currentDay++; if ($currentDay != $nextDay){ if ($firstprint) $dayFriendly .= ", "; @@ -642,13 +644,13 @@ if($_REQUEST['undodrag']) { $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; else $dayFriendly .= $dayArray[$firstDay-1]; - $firstDayFound = false; - $firstprint = true; + $firstDayFound = false; + $firstprint = true; } $counter++; } } - } + } $timeFriendly = $starttime . " - " . $stoptime; $description = $timerange['rangedescr']; $sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>"; @@ -663,242 +665,242 @@ if($_REQUEST['undodrag']) { $printicon = false; $alttext = ""; $image = ""; - if (!isset($filterent['disabled'])){ - if ($schedstatus) - { - if ($iconfn == "block" || $iconfn == "reject") - { - $image = "icon_block"; - $alttext = gettext("Traffic matching this rule is currently being denied"); - } - else - { - $image = "icon_pass"; - $alttext = gettext("Traffic matching this rule is currently being allowed"); - } - $printicon = true; - } - else if ($filterent['sched']) - { - if ($iconfn == "block" || $iconfn == "reject") - $image = "icon_block_d"; - else - $image = "icon_block"; - $alttext = gettext("This rule is not currently active because its period has expired"); - $printicon = true; - } + if (!isset($filterent['disabled'])) { + if ($schedstatus) { + if ($iconfn == "block" || $iconfn == "reject") { + $image = "icon_block"; + $alttext = gettext("Traffic matching this rule is currently being denied"); + } else { + $image = "icon_pass"; + $alttext = gettext("Traffic matching this rule is currently being allowed"); + } + $printicon = true; + } else if ($filterent['sched']) { + if ($iconfn == "block" || $iconfn == "reject") + $image = "icon_block_d"; + else + $image = "icon_block"; + $alttext = gettext("This rule is not currently active because its period has expired"); + $printicon = true; + } } - ?> - <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']." "; else echo " "; ?><?=$textse;?> - </td> -<?php + ?> + <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']." "; else echo " "; ?><?=$textse;?> + </td> + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr"); -?> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php - if (isset($filterent['ipprotocol'])) { - switch($filterent['ipprotocol']) { - case "inet": - echo "IPv4 "; - break; - case "inet6": - echo "IPv6 "; - break; - case "inet46": - echo "IPv4+6 "; - break; - } - } else { - echo "IPv4 "; - } - if (isset($filterent['protocol'])) { - echo strtoupper($filterent['protocol']); - if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) { - echo ' <span style="cursor: help;" title="ICMP type: ' . $icmptypes[$filterent['icmptype']] . '"><u>'; - echo $filterent['icmptype']; - echo '</u></span>'; + ?> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?> + <?php + if (isset($filterent['ipprotocol'])) { + switch($filterent['ipprotocol']) { + case "inet": + echo "IPv4 "; + break; + case "inet6": + echo "IPv6 "; + break; + case "inet46": + echo "IPv4+6 "; + break; + } + } else { + echo "IPv4 "; } - } else echo "*"; - ?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> - <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><?=$textss;?> - <?php - if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) { - $desc = $filterent['ackqueue'] ; - echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>"; - $desc = $filterent['defaultqueue']; - echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; - } else if (isset($filterent['defaultqueue'])) { - $desc = $filterent['defaultqueue']; - echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; } - else echo gettext("none"); - ?><?=$textse;?> - </td> - <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black"> - <?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0"><?php } ?> <?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?><?php echo $schedule_span_end; ?><?=$textse;?> - </td> -<?php + if (isset($filterent['protocol'])) { + echo strtoupper($filterent['protocol']); + if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) { + echo ' <span style="cursor: help;" title="ICMP type: ' . $icmptypes[$filterent['icmptype']] . '"><u>'; + echo $filterent['icmptype']; + echo '</u></span>'; + } + } else echo "*"; + ?> + <?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"> + <?=$textss;?> + <?php + if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) { + $desc = $filterent['ackqueue'] ; + echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>"; + $desc = $filterent['defaultqueue']; + echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; + } else if (isset($filterent['defaultqueue'])) { + $desc = $filterent['defaultqueue']; + echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; + } else + echo gettext("none"); + ?> + <?=$textse;?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black"> + <?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0"><?php } ?> <?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?><?php echo $schedule_span_end; ?><?=$textse;?> + </td> + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr"); -?> - <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" class="descr"> - <?=$textss;?><?=htmlspecialchars($filterent['descr']);?> <?=$textse;?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> + ?> + <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" class="descr"> + <?=$textss;?><?=htmlspecialchars($filterent['descr']);?> <?=$textse;?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule"); ?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"></td> - <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule"); ?>" width="17" height="17" border="0"></a></td> + <td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule"); ?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"></td> + <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule"); ?>" width="17" height="17" border="0"></a></td> </tr> <tr> - <td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule"); ?>" onclick="return confirm('Do you really want to delete this rule?')"></a></td> - <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new rule based on this one"); ?>" width="17" height="17" border="0"></a></td> + <td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule"); ?>" onclick="return confirm('Do you really want to delete this rule?')"></a></td> + <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new rule based on this one"); ?>" width="17" height="17" border="0"></a></td> </tr> - </table> - </td> - </tr> - <?php $nrules++; endfor; ?> + </table> + </td> + </tr> + <?php $nrules++; endfor; ?> </tbody> - <?php if ($nrules == 0): ?> - <td class="listt"></td> - <td class="listt"></td> - <td class="listlr" colspan="10" align="center" valign="middle"> - <span class="gray"> - <?php if ($_REQUEST['if'] == "FloatingRules"): ?> - <?=gettext("No floating rules are currently defined."); ?><br/><br/> - <?php else: ?> - <?=gettext("No rules are currently defined for this interface"); ?><br/> - <?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br/><br/> - <?php endif; ?> - <?=gettext("Click the"); ?> <a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" border="0" width="17" height="17" align="absmiddle"></a><?=gettext(" button to add a new rule.");?></span> - </td> - <?php endif; ?> - <tr id="fr<?=$nrules;?>"> - <td class="list"></td> - <td class="list"></td> -<?php +<?php if ($nrules == 0): ?> + <td class="listt"></td> + <td class="listt"></td> + <td class="listlr" colspan="10" align="center" valign="middle"> + <span class="gray"> + <?php if ($_REQUEST['if'] == "FloatingRules"): ?> + <?=gettext("No floating rules are currently defined."); ?><br/><br/> + <?php else: ?> + <?=gettext("No rules are currently defined for this interface"); ?><br/> + <?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br/><br/> + <?php endif; ?> + <?=gettext("Click the"); ?> <a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" border="0" width="17" height="17" align="absmiddle"></a><?=gettext(" button to add a new rule.");?></span> + </td> +<?php endif; ?> + <tr id="fr<?=$nrules;?>"> + <td class="list"></td> + <td class="list"></td> + <?php pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable"); -?> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> </td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td> - <?php if ($nrules == 0): ?><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"><?php endif; ?></td> - <td></td> - </tr> + ?> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> </td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td> - <?php if ($nrules == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0"><?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"><?php endif; ?> - </td> - <td><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td> + <td> + <?php if ($nrules == 0): ?><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"><?php endif; ?></td> + <td></td> </tr> - </table> - </td> - </tr> - </table> - <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11"></td> - <td><?=gettext("pass");?></td> - <td width="14"></td> - <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11"></td> - <td><?=gettext("block");?></td> - <td width="14"></td> - <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11"></td> - <td><?=gettext("reject");?></td> - <td width="14"></td> - <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11"></td> - <td><?=gettext("log");?></td> - </tr> - <tr> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11"></td> - <td nowrap><?=gettext("pass (disabled)");?></td> - <td> </td> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11"></td> - <td nowrap><?=gettext("block (disabled)");?></td> - <td> </td> - <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11"></td> - <td nowrap><?=gettext("reject (disabled)");?></td> - <td> </td> - <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11"></td> - <td nowrap><?=gettext("log (disabled)");?></td> - </tr> - <tr> - <td colspan="10"> - <p/> - <strong> - <span class="red"><?=gettext("Hint:");?></span> - </strong><br> - <ul> -<?php if ("FloatingRules" != $if): ?> - <li><?=gettext("Rules are evaluated on a first-match basis (i.e. " . - "the action of the first rule to match a packet will be executed). " . - "This means that if you use block rules, you'll have to pay attention " . - "to the rule order. Everything that isn't explicitly passed is blocked " . - "by default. ");?> - </li> -<?php else: ?> - <li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " . - "the action of the first rule to match a packet will be executed) only " . - "if the 'quick' option is checked on a rule. Otherwise they will only apply if no " . - "other rules match. Pay close attention to the rule order and options " . - "chosen. If no rule here matches, the per-interface or default rules are used. ");?> - </li> + <tr> + <td> +<?php if ($nrules == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0"><?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"> <?php endif; ?> -</ul> - </td> - </tr> - </table> - </div> - </td> - </tr> + </td> + <td><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11"></td> + <td><?=gettext("pass");?></td> + <td width="14"></td> + <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11"></td> + <td><?=gettext("block");?></td> + <td width="14"></td> + <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11"></td> + <td><?=gettext("reject");?></td> + <td width="14"></td> + <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11"></td> + <td><?=gettext("log");?></td> + </tr> + <tr> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11"></td> + <td nowrap><?=gettext("pass (disabled)");?></td> + <td> </td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11"></td> + <td nowrap><?=gettext("block (disabled)");?></td> + <td> </td> + <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11"></td> + <td nowrap><?=gettext("reject (disabled)");?></td> + <td> </td> + <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11"></td> + <td nowrap><?=gettext("log (disabled)");?></td> + </tr> + <tr> + <td colspan="10"> + <p/> + <strong> + <span class="red"><?=gettext("Hint:");?></span> + </strong><br> + <ul> + <?php if ("FloatingRules" != $if): ?> + <li><?=gettext("Rules are evaluated on a first-match basis (i.e. " . + "the action of the first rule to match a packet will be executed). " . + "This means that if you use block rules, you'll have to pay attention " . + "to the rule order. Everything that isn't explicitly passed is blocked " . + "by default. ");?> + </li> + <?php else: ?> + <li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " . + "the action of the first rule to match a packet will be executed) only " . + "if the 'quick' option is checked on a rule. Otherwise they will only apply if no " . + "other rules match. Pay close attention to the rule order and options " . + "chosen. If no rule here matches, the per-interface or default rules are used. ");?> + </li> + <?php endif; ?> + </ul> + </td> + </tr> + </table> + </div> + </td> + </tr> </table> - <input type="hidden" name="if" value="<?=htmlspecialchars($if);?>"> - <script type="text/javascript"> +<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>"> +<script type="text/javascript"> var number_of_rules = <?=$nrules?>; -<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?> -/* - Sortable.create("dragtable", { - tag:"tr", - format:"fr([0-9999999])", - containment:["dragtable"], - onChange:function(affected) { - document.body.style.cursor = 'move'; - }, - onUpdate:function(container) { - document.body.style.cursor = 'move'; - updateOrder(Sortable.serialize('dragtable', 'tr')); - } - }); -*/ -<?php endfor; ?> + <?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?> + /* + Sortable.create("dragtable", { + tag:"tr", + format:"fr([0-9999999])", + containment:["dragtable"], + onChange:function(affected) { + document.body.style.cursor = 'move'; + }, + onUpdate:function(container) { + document.body.style.cursor = 'move'; + updateOrder(Sortable.serialize('dragtable', 'tr')); + } + }); + */ + <?php endfor; ?> function updateOrder(order) { if(document.getElementById("redboxtable")) jQuery('#redboxtable').hide(); @@ -908,7 +910,7 @@ if($_REQUEST['undodrag']) { return; } jQuery('#loading').hide(); - </script> +</script> </form> <?php include("fend.inc"); ?> </body> diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index fed5e5c..4213380 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -105,7 +105,7 @@ if ($_POST) { $reqdfields = explode(" ", "mode"); $reqdfieldsn = array(gettext("Type")); - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); if ($_POST['subnet']) $_POST['subnet'] = trim($_POST['subnet']); @@ -132,6 +132,22 @@ if ($_POST) { $input_errors[] = gettext("The /127 and /128 subnet mask are invalid for CARP IPs."); } + /* ipalias and carp should not use network or broadcast address */ + if ($_POST['mode'] == "ipalias" || $_POST['mode'] == "carp") { + if (is_ipaddrv4($_POST['subnet']) && $_POST['subnet_bits'] != "32") { + $network_addr = gen_subnet($_POST['subnet'], $_POST['subnet_bits']); + $broadcast_addr = gen_subnet_max($_POST['subnet'], $_POST['subnet_bits']); + } else if (is_ipaddrv6($_POST['subnet']) && $_POST['subnet_bits'] != "128" ) { + $network_addr = gen_subnetv6($_POST['subnet'], $_POST['subnet_bits']); + $broadcast_addr = gen_subnetv6_max($_POST['subnet'], $_POST['subnet_bits']); + } + + if (isset($network_addr) && $_POST['subnet'] == $network_addr) + $input_errors[] = gettext("You cannot use the network address for this VIP"); + else if (isset($broadcast_addr) && $_POST['subnet'] == $broadcast_addr) + $input_errors[] = gettext("You cannot use the broadcast address for this VIP"); + } + /* make sure new ip is within the subnet of a valid ip * on one of our interfaces (wan, lan optX) */ @@ -147,31 +163,36 @@ if ($_POST) { if (empty($_POST['password'])) $input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members."); - if(is_ipaddrv4($_POST['subnet'])) { + if (is_ipaddrv4($_POST['subnet'])) { $parent_ip = get_interface_ip($_POST['interface']); $parent_sn = get_interface_subnet($_POST['interface']); - if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { - $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; - $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); - } - } - if(is_ipaddrv6($_POST['subnet'])) { + $subnet = gen_subnet($parent_ip, $parent_sn); + } else if (is_ipaddrv6($_POST['subnet'])) { $parent_ip = get_interface_ipv6($_POST['interface']); $parent_sn = get_interface_subnetv6($_POST['interface']); $subnet = gen_subnetv6($parent_ip, $parent_sn); - if (!ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { - $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; - $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); - } } + + if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { + $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; + $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); + } + if (strstr($_POST['interface'], "_vip")) $input_errors[] = gettext("For this type of vip a carp parent is not allowed."); break; case "ipalias": if (strstr($_POST['interface'], "_vip")) { - $parent_ip = get_interface_ip($_POST['interface']); - $parent_sn = get_interface_subnet($_POST['interface']); - if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { + if (is_ipaddrv4($_POST['subnet'])) { + $parent_ip = get_interface_ip($_POST['interface']); + $parent_sn = get_interface_subnet($_POST['interface']); + $subnet = gen_subnet($parent_ip, $parent_sn); + } else if (is_ipaddrv6($_POST['subnet'])) { + $parent_ip = get_interface_ipv6($_POST['interface']); + $parent_sn = get_interface_subnetv6($_POST['interface']); + $subnet = gen_subnetv6($parent_ip, $parent_sn); + } + if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); } @@ -183,7 +204,6 @@ if ($_POST) { break; } - if (!$input_errors) { $vipent = array(); diff --git a/usr/local/www/index.php b/usr/local/www/index.php index c8d721c..f70e376 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -161,8 +161,8 @@ if (!is_array($config['widgets'])) { if(file_exists('/conf/trigger_initial_wizard')) { echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>{$g['product_name']}.localdomain - {$g['product_name']} first time setup</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> @@ -175,13 +175,13 @@ EOF; echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n"; if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) - echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; else - echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; echo "<form>\n"; echo "<center>\n"; - echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n"; + echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\" alt=\"logo\" /><p>\n"; echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n"; echo sprintf(gettext("Welcome to %s!\n"),$g['product_name']) . "<p>"; echo gettext("One moment while we start the initial setup wizard.") . "<p>\n"; @@ -190,8 +190,10 @@ EOF; echo "</div>\n"; echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n"; echo "<script type=\"text/javascript\">\n"; + echo "//<![CDATA[\n"; echo "NiftyCheck();\n"; echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n"; + echo "//]]>\n"; echo "</script>\n"; exit; } @@ -274,8 +276,8 @@ foreach($phpincludefiles as $includename) { ##begin AJAX $jscriptstr = <<<EOD -<script language="javascript" type="text/javascript"> - +<script type="text/javascript"> +//<![CDATA[ function widgetAjax(widget) { uri = "widgets/widgets/" + widget + ".widget.php"; @@ -457,10 +459,10 @@ function changeTabDIV(selectedDiv){ } } } - +//]]> </script> EOD; -$closehead = false; + ## Set Page Title and Include Header $pgtitle = array(gettext("Status: Dashboard")); @@ -470,18 +472,17 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<script language="javascript" type="text/javascript"> -// <![CDATA[ +<script type="text/javascript"> +//<![CDATA[ columns = ['col1','col2']; -// ]]> - +//]]> </script> <?php include("fbegin.inc"); echo $jscriptstr; if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo")) - echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>"; + echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\" alt=\"big logo\" /></center><br />"; if ($savemsg) print_info_box($savemsg); @@ -511,12 +512,12 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); //echo widget title ?> <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> - <u><?php echo $$widgettitle; ?></u></span><br> + <u><?php echo $$widgettitle; ?></u></span><br /> <?php } else {?> <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> - <u><?php echo $nicename; ?></u></span><br><?php + <u><?php echo $nicename; ?></u></span><br /><?php } } ?> @@ -526,18 +527,16 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); <div id="welcomecontainer" style="display:none"> <div id="welcome-container"> - <h1> - <div style="float:left;width:80%;padding: 2px"> - <?=gettext("Welcome to the Dashboard page"); ?>! - </div> - <div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" > - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" /> - </div> - <div style="clear:both;"></div> - </h1> + <div style="float:left;width:80%;padding: 2px"> + <h1><?=gettext("Welcome to the Dashboard page"); ?>!</h1> + </div> + <div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" > + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" /> + </div> + <div style="clear:both;"></div> <p> <?=gettext("This page allows you to customize the information you want to be displayed!");?><br/> - <?=gettext("To get started click the");?> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> <?=gettext("icon to add widgets.");?><br/> + <?=gettext("To get started click the");?> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="plus" /> <?=gettext("icon to add widgets.");?><br/> <br/> <?=gettext("You can move any widget around by clicking and dragging the title.");?> </p> @@ -545,7 +544,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); </div> <form action="index.php" method="post"> -<input type="hidden" value="" name="sequence" id="sequence"> +<input type="hidden" value="" name="sequence" id="sequence" /> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="<?=gettext("Click here to add widgets"); ?>" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="<?=gettext("Click here for help"); ?>" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> @@ -553,7 +552,6 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); <input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="<?=gettext("Save Settings");?>" /> -</p> </form> <div id="niftyOutter"> <?php @@ -662,7 +660,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); ?> <div style="clear:both;"></div> <div id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;"> - <input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input"> + <input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input" /> <div id="<?php echo $widgetname;?>-topic" class="widgetheader" style="cursor:move"> <div style="float:left;"> <?php @@ -673,7 +671,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); { //only show link if defined if ($$widgettitlelink != "") {?> - <u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> + <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> <?php } //echo widget title echo $$widgettitle; @@ -683,7 +681,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); } else{ if ($$widgettitlelink != "") {?> - <u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> + <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> <?php } echo $nicename; if ($$widgettitlelink != "") { ?> @@ -693,20 +691,18 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); ?> </div> <div align="right" style="float:right;"> - <div id="<?php echo $widgetname;?>-configure" onclick='return configureWidget("<?php echo $widgetname;?>")' style="display:none; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_configure.gif" /></div> - <div id="<?php echo $widgetname;?>-open" onclick='return showWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $showWidget;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" /></div> - <div id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif"/></div> - <div id="<?php echo $widgetname;?>-close" onclick='return closeWidget("<?php echo $widgetname;?>",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" /></div> + <div id="<?php echo $widgetname;?>-configure" onclick='return configureWidget("<?php echo $widgetname;?>")' style="display:none; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_configure.gif" alt="configure" /></div> + <div id="<?php echo $widgetname;?>-open" onclick='return showWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $showWidget;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="open" /></div> + <div id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="minimize" /></div> + <div id="<?php echo $widgetname;?>-close" onclick='return closeWidget("<?php echo $widgetname;?>",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" /></div> </div> <div style="clear:both;"></div> </div> <?php if ($divdisplay != "block") { ?> - <div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;"> - <br> - <center> - <img src="./themes/<?= $g['theme']; ?>/images/misc/widget_loader.gif" width=25 height=25 alt="<?=gettext("Loading selected widget"); ?>..."> - </center> - <br> + <div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;" align="center"> + <br /> + <img src="./themes/<?= $g['theme']; ?>/images/misc/widget_loader.gif" width="25" height="25" alt="<?=gettext("Loading selected widget"); ?>..." /> + <br /> </div> <?php } if ($divdisplay != "block") $display = none; ?> <div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;"> <?php @@ -730,6 +726,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); <?php include("fend.inc"); ?> <script type="text/javascript"> +//<![CDATA[ jQuery(document).ready(function(in_event) { jQuery('#col1').sortable({connectWith: '#col2', dropOnEmpty: true, handle: '.widgetheader', change: showSave}); @@ -740,6 +737,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle'); <?php } ?> }); +//]]> </script> <?php //build list of javascript include files @@ -756,7 +754,6 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); echo "<script src='{$directory}{$jsincludename}' type='text/javascript'></script>\n"; } ?> -</script> </body> -</html> +</html>
\ No newline at end of file diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index dde7956..0be890b 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -373,6 +373,9 @@ if ($_POST['apply']) { filter_configure(); enable_rrd_graphing(); + + if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) + clear_subsystem_dirty('staticroutes'); } @unlink("{$g['tmp_path']}/.interfaces.apply"); header("Location: interfaces.php?if={$if}"); @@ -2735,7 +2738,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), var defaultgw = jQuery('#defaultgw').val(); var url = "system_gateways_edit.php"; - var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip); + var pars = 'isAjax=true&ipprotocol=inet&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip); jQuery.ajax( url, { @@ -2754,7 +2757,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), gatewayip = jQuery('#gatewayipv6').val(); var defaultgw = jQuery('#defaultgwv6').val(); var url_v6 = "system_gateways_edit.php"; - var pars_v6 = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip); + var pars_v6 = 'isAjax=true&ipprotocol=inet6&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip); jQuery.ajax( url_v6, { @@ -2798,8 +2801,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), } hide_add_gateway_v6(); } - function save_callback(transport) { - var response = transport.responseText; + function save_callback(response) { if(response) { document.getElementById("addgateway").style.display = 'none'; hide_add_gateway(); @@ -2817,8 +2819,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), aodiv = document.getElementById('showmediaadv'); aodiv.style.display = "block"; } - function save_callback_v6(transport) { - var response_v6 = transport.responseText; + function save_callback_v6(response_v6) { if(response_v6) { document.getElementById("addgatewayv6").style.display = 'none'; hide_add_gateway_v6(); diff --git a/usr/local/www/status_captiveportal_voucher_rolls.php b/usr/local/www/status_captiveportal_voucher_rolls.php index 7ad778f..742964d 100644 --- a/usr/local/www/status_captiveportal_voucher_rolls.php +++ b/usr/local/www/status_captiveportal_voucher_rolls.php @@ -1,30 +1,30 @@ -<?php +<?php /* - Copyright (C) 2007 Marcel Wiget <mwiget@mac.com>. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 2007 Marcel Wiget <mwiget@mac.com>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_MODULE: captiveportal */ @@ -44,21 +44,21 @@ require_once("voucher.inc"); $cpzone = $_GET['zone']; if (isset($_POST['zone'])) - $cpzone = $_POST['zone']; + $cpzone = $_POST['zone']; if (empty($cpzone)) { - header("Location: services_captiveportal_zones.php"); - exit; + header("Location: services_captiveportal_zones.php"); + exit; } if (!is_array($config['captiveportal'])) - $config['captiveportal'] = array(); + $config['captiveportal'] = array(); $a_cp =& $config['captiveportal']; $pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Voucher Rolls"), $a_cp[$cpzone]['zone']); $shortcut_section = "captiveportal-vouchers"; if (!is_array($config['voucher'][$cpzone]['roll'])) { - $config['voucher'][$cpzone]['roll'] = array(); + $config['voucher'][$cpzone]['roll'] = array(); } $a_roll = &$config['voucher'][$cpzone]['roll']; @@ -68,64 +68,67 @@ include("fbegin.inc"); <form action="status_captiveportal_voucher_rolls.php" method="post" enctype="multipart/form-data" name="iform" id="iform"> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane"> -<tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); - $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}"); - $tab_array[] = array(gettext("Voucher Rolls"), true, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); - $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}"); - $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); - display_top_tabs($tab_array); -?> -</td></tr> -<tr> -<td class="tabcont"> - -<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="content pane"> - <tr> - <td class="listhdrr"><?=gettext("Roll#"); ?></td> - <td class="listhdrr"><?=gettext("Minutes/Ticket"); ?></td> - <td class="listhdrr"><?=gettext("# of Tickets"); ?></td> - <td class="listhdrr"><?=gettext("Comment"); ?></td> - <td class="listhdrr"><?=gettext("used"); ?></td> - <td class="listhdrr"><?=gettext("active"); ?></td> - <td class="listhdr"><?=gettext("ready"); ?></td> - </tr> -<?php - $voucherlck = lock("vouche{$cpzone}r"); - $i = 0; foreach($a_roll as $rollent): - $used = voucher_used_count($rollent['number']); - $active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']); - $ready = $rollent['count'] - $used; -?> - <tr> - <td class="listlr"> - <?=htmlspecialchars($rollent['number']); ?> - </td> - <td class="listr"> - <?=htmlspecialchars($rollent['minutes']);?> - </td> - <td class="listr"> - <?=htmlspecialchars($rollent['count']);?> - </td> - <td class="listr"> - <?=htmlspecialchars($rollent['comment']); ?> - </td> - <td class="listr"> - <?=htmlspecialchars($used); ?> - </td> - <td class="listr"> - <?=htmlspecialchars($active); ?> - </td> - <td class="listr"> - <?=htmlspecialchars($ready); ?> - </td> - </tr> - <?php $i++; endforeach; unlock($voucherlck); ?> -</table> -</td> -</tr> -</table> + <tr> + <td class="tabnavtbl"> + <?php + $tab_array = array(); + $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); + $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}"); + $tab_array[] = array(gettext("Voucher Rolls"), true, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); + $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}"); + $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); + display_top_tabs($tab_array); + ?> + </td> + </tr> + <tr> + <td class="tabcont"> + <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="content pane"> + <tr> + <td class="listhdrr"><?=gettext("Roll#"); ?></td> + <td class="listhdrr"><?=gettext("Minutes/Ticket"); ?></td> + <td class="listhdrr"><?=gettext("# of Tickets"); ?></td> + <td class="listhdrr"><?=gettext("Comment"); ?></td> + <td class="listhdrr"><?=gettext("used"); ?></td> + <td class="listhdrr"><?=gettext("active"); ?></td> + <td class="listhdr"><?=gettext("ready"); ?></td> + </tr> + <?php + $voucherlck = lock("vouche{$cpzone}r"); + $i = 0; foreach($a_roll as $rollent): + $used = voucher_used_count($rollent['number']); + $active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']); + $ready = $rollent['count'] - $used; + /* used also count active vouchers, remove them */ + $used = $used - $active; + ?> + <tr> + <td class="listlr"> + <?=htmlspecialchars($rollent['number']); ?> + </td> + <td class="listr"> + <?=htmlspecialchars($rollent['minutes']);?> + </td> + <td class="listr"> + <?=htmlspecialchars($rollent['count']);?> + </td> + <td class="listr"> + <?=htmlspecialchars($rollent['comment']); ?> + </td> + <td class="listr"> + <?=htmlspecialchars($used); ?> + </td> + <td class="listr"> + <?=htmlspecialchars($active); ?> + </td> + <td class="listr"> + <?=htmlspecialchars($ready); ?> + </td> + </tr> + <?php $i++; endforeach; unlock($voucherlck); ?> + </table> + </td> + </tr> +</table> </form> <?php include("fend.inc"); ?> diff --git a/usr/local/www/status_ntpd.php b/usr/local/www/status_ntpd.php index 2b9ac72..30cf18e 100644 --- a/usr/local/www/status_ntpd.php +++ b/usr/local/www/status_ntpd.php @@ -100,8 +100,14 @@ foreach ($ntpq_clockvar_output as $line) { if (substr($tmp, 0, 6) == '$GPRMC') { $gps_vars = explode(",", $tmp); $gps_ok = ($gps_vars[2] == "A"); - $gps_lat = $gps_vars[3] / 100.0 . $gps_vars[4]; - $gps_lon = $gps_vars[5] / 100.0 . $gps_vars[6]; + $gps_lat_deg = substr($gps_vars[3], 0, 2); + $gps_lat_min = substr($gps_vars[3], 2) / 60.0; + $gps_lon_deg = substr($gps_vars[5], 0, 3); + $gps_lon_min = substr($gps_vars[5], 3) / 60.0; + $gps_lat = $gps_lat_deg + $gps_lat_min; + $gps_lat = $gps_lat * (($gps_vars[4] == "N") ? 1 : -1); + $gps_lon = $gps_lon_deg + $gps_lon_min; + $gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1); } } } @@ -188,8 +194,8 @@ include("head.inc"); </thead> <tbody> <tr> - <td class="listlr" align="center"><?php echo $gps_lat; ?></td> - <td class="listlr" align="center"><?php echo $gps_lon; ?></td> + <td class="listlr" align="center"><?php echo sprintf("%.5f", $gps_lat); ?> (<?php echo sprintf("%d", $gps_lat_deg); ?>° <?php echo sprintf("%.5f", $gps_lat_min*60); ?><?php echo $gps_vars[4]; ?>)</td> + <td class="listlr" align="center"><?php echo sprintf("%.5f", $gps_lon); ?> (<?php echo sprintf("%d", $gps_lon_deg); ?>° <?php echo sprintf("%.5f", $gps_lon_min*60); ?><?php echo $gps_vars[6]; ?>)</td> </tr> <tr> <td class="listlr" colspan="2" align="center"><a href="http://maps.google.com/?q=<?php echo $gps_lat; ?>,<?php echo $gps_lon; ?>">Google Maps Link</a></td> diff --git a/usr/local/www/status_queues.php b/usr/local/www/status_queues.php index c147a57..fb2930a 100755 --- a/usr/local/www/status_queues.php +++ b/usr/local/www/status_queues.php @@ -50,6 +50,7 @@ header("Pragma: no-cache"); // HTTP/1.0 require("guiconfig.inc"); class QueueStats { public $queuename; + public $queuelength; public $pps; public $bandwidth; public $borrows; @@ -89,15 +90,16 @@ if ($_REQUEST['getactivity']) { } $finscript = ""; foreach($statistics as $q) { - $packet_s = round(200 * (1 - $q->pps / $bigger_packets), 0); + $packet_s = round(150 * (1 - $q->pps / $bigger_packets), 0); if ($packet_s < 0) {$packet_s = 0;} $finscript .= "jQuery('#queue{$q->queuename}widthb').width('{$packet_s}');"; - $finscript .= "jQuery('#queue{$q->queuename}widtha').width('" . (200 - $packet_s) . "');"; + $finscript .= "jQuery('#queue{$q->queuename}widtha').width('" . (150 - $packet_s) . "');"; $finscript .= "jQuery('#queue{$q->queuename}pps').val('" . number_format($q->pps,1) . "');"; $finscript .= "jQuery('#queue{$q->queuename}bps').val('" . format_bits($q->bandwidth) . "');"; $finscript .= "jQuery('#queue{$q->queuename}borrows').val('{$q->borrows}');"; $finscript .= "jQuery('#queue{$q->queuename}suspends').val('{$q->suspends}');"; $finscript .= "jQuery('#queue{$q->queuename}drops').val('{$q->drops}');"; + $finscript .= "jQuery('#queue{$q->queuename}length').val('{$q->queuelength}');"; } unset($statistics, $altqstats); header("Content-type: text/javascript"); @@ -150,6 +152,7 @@ if(!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < <td class="listhdr" width="1%"><?=gettext("Borrows"); ?></td> <td class="listhdr" width="1%"><?=gettext("Suspends"); ?></td> <td class="listhdr" width="1%"><?=gettext("Drops"); ?></td> + <td class="listhdr" width="1%"><?=gettext("Length"); ?></td> </tr> <?php $if_queue_list = get_configured_interface_list_by_realif(false, true); @@ -157,8 +160,8 @@ if(!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < <?php endif; ?> </table> <p> - <strong><span class="red"><?=gettext("Note"); ?>:</span></strong><strong><br></strong> - <?=gettext("Queue graphs take 5 seconds to sample data"); ?>.<br> + <strong><span class="red"><?=gettext("Note"); ?>:</span></strong><br/> + <?=gettext("Queue graphs take 5 seconds to sample data"); ?>.<br/> <?=gettext("You can configure the Traffic Shaper"); ?> <a href="/firewall_shaper_wizards.php"><?=gettext("here"); ?></a>. </p> <script type="text/javascript"> @@ -170,6 +173,7 @@ if(!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < jQuery("." + classname).show();} } </script> +</form> <?php include("fend.inc"); ?> </body> </html> @@ -181,44 +185,48 @@ function processQueues($altqstats, $level, $parent_name){ if ($gray_value > 250) $gray_value = 255; $row_background = str_repeat(dechex($gray_value), 3); $parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface']; + $prev_if = $altqstats['interface']; foreach ($altqstats['queue'] as $q) { $if_name = ""; - foreach ($if_queue_list as $oif => $real_name) - { - if ($oif == $q['interface']) - { + foreach ($if_queue_list as $oif => $real_name) { + if ($oif == $q['interface']) { $if_name = $real_name; break; } } + if ($prev_if != $q['interface']) { + echo "<tr><td colspan=\"8\" style=\"padding: 2px;\"><b>Interface ". htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>"; + $prev_if = $q['interface']; + } ?> <tr class="<?php echo $parent_name?>"> <td bgcolor="#<?php echo $row_background?>" style="padding-left: <?php echo $level * 20?>px;"> <font color="#000000"> <? if (strstr($q['name'], "root_")) - echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">" . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</a>"; + echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>"; else - echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>"; + echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>"; ?> </font> </td> <?php $cpuUsage = 0; - echo "<td bgcolor=\"#{$row_background}\"><nobr>"; - echo "<img src='./themes/".$g['theme']."/images/misc/bar_left.gif' height='10' width='4' border='0' align='absmiddle'>"; - echo "<img src='./themes/".$g['theme']."/images/misc/bar_blue.gif' height='10' name='queue{$q['name']}{$q['interface']}widtha' id='queue{$q['name']}{$q['interface']}widtha' width='" . $cpuUsage . "' border='0' align='absmiddle'>"; - echo "<img src='./themes/".$g['theme']."/images/misc/bar_gray.gif' height='10' name='queue{$q['name']}{$q['interface']}widthb' id='queue{$q['name']}{$q['interface']}widthb' width='" . (200 - $cpuUsage) . "' border='0' align='absmiddle'>"; - echo "<nobr><img src='./themes/".$g['theme']."/images/misc/bar_right.gif' height='10' width='5' border='0' align='absmiddle'> "; + echo "<td nowrap=\"nowrap\" width=\"1%\" bgcolor=\"#{$row_background}\">"; + echo "<img src='./themes/".$g['theme']."/images/misc/bar_left.gif' height='10' width='4' border='0' align='middle' alt='' />"; + echo "<img src='./themes/".$g['theme']."/images/misc/bar_blue.gif' height='10' name='queue{$q['name']}{$q['interface']}widtha' id='queue{$q['name']}{$q['interface']}widtha' width='" . $cpuUsage . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />"; + echo "<img src='./themes/".$g['theme']."/images/misc/bar_gray.gif' height='10' name='queue{$q['name']}{$q['interface']}widthb' id='queue{$q['name']}{$q['interface']}widthb' width='" . (150 - $cpuUsage) . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />"; + echo "<img src='./themes/".$g['theme']."/images/misc/bar_right.gif' height='10' width='5' border='0' align='middle' alt='' /> "; if (is_array($q['queue'])) { - echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>"; + echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> "; } - echo "</nobr></td>"; - echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left'></td>"; - echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right'></td>"; - echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right'></td>"; - echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right'></td>"; - echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right'></td>"; + echo " </td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>"; + echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>"; ?> </tr> <?php @@ -232,13 +240,13 @@ function statsQueues($xml){ $current = new QueueStats(); $child = new QueueStats(); $current->queuename = $xml['name'] . $xml['interface']; + $current->queuelength = $xml['qlength']; $current->pps = $xml['measured']; $current->bandwidth = $xml['measuredspeedint']; $current->borrows = intval($xml['borrows']); $current->suspends = intval($xml['suspends']); - $current->drops = intval($xml['drops']); - if (is_array($xml['queue'])) - { + $current->drops = intval($xml['droppedpkts']); + if (is_array($xml['queue'])) { foreach($xml['queue'] as $q) { $child = statsQueues($q); $current->pps += $child->pps; diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index bfee28f..2cf22de 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -250,7 +250,7 @@ $pgtitle = array(gettext("Status"),gettext("RRD Graphs")); $closehead = false; /* Load all CP zones */ -if ($captiveportal) { +if ($captiveportal && is_array($config['captiveportal'])) { $cp_zones_tab_array = array(); foreach($config['captiveportal'] as $cpkey => $cp) { if (!isset($cp['enable'])) diff --git a/usr/local/www/system_camanager.php b/usr/local/www/system_camanager.php index 0033339..49fd32d 100644 --- a/usr/local/www/system_camanager.php +++ b/usr/local/www/system_camanager.php @@ -600,6 +600,7 @@ function method_change() { $name = htmlspecialchars($ca['descr']); $subj = cert_get_subject($ca['crt']); $issuer = cert_get_issuer($ca['crt']); + list($startdate, $enddate) = cert_get_dates($ca['crt']); if($subj == $issuer) $issuer_name = "<em>" . gettext("self-signed") . "</em>"; else @@ -645,7 +646,20 @@ function method_change() { <td class="listr"><?=$internal;?> </td> <td class="listr"><?=$issuer_name;?> </td> <td class="listr"><?=$certcount;?> </td> - <td class="listr"><?=$subj;?> </td> + <td class="listr"><?=$subj;?><br /> + <table width="100%" style="font-size: 9px"> + <tr> + <td width="10%"> </td> + <td width="20%"><?=gettext("Valid From")?>:</td> + <td width="70%"><?= $startdate ?></td> + </tr> + <tr> + <td> </td> + <td><?=gettext("Valid Until")?>:</td> + <td><?= $enddate ?></td> + </tr> + </table> + </td> <td valign="middle" nowrap class="list"> <a href="system_camanager.php?act=edit&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit CA");?>" alt="<?=gettext("edit CA");?>" width="17" height="17" border="0" /> diff --git a/usr/local/www/system_certmanager.php b/usr/local/www/system_certmanager.php index 74d6884..12682de 100644 --- a/usr/local/www/system_certmanager.php +++ b/usr/local/www/system_certmanager.php @@ -1074,6 +1074,7 @@ function internalca_change() { $subj = cert_get_subject($cert['crt']); $issuer = cert_get_issuer($cert['crt']); $purpose = cert_get_purpose($cert['crt']); + list($startdate, $enddate) = cert_get_dates($cert['crt']); if($subj==$issuer) $caname = "<em>" . gettext("self-signed") . "</em>"; else @@ -1119,7 +1120,20 @@ function internalca_change() { </table> </td> <td class="listr"><?=$caname;?> </td> - <td class="listr"><?=$subj;?> </td> + <td class="listr"><?=$subj;?> <br /> + <table width="100%" style="font-size: 9px"> + <tr> + <td width="10%"> </td> + <td width="20%"><?=gettext("Valid From")?>:</td> + <td width="70%"><?= $startdate ?></td> + </tr> + <tr> + <td> </td> + <td><?=gettext("Valid Until")?>:</td> + <td><?= $enddate ?></td> + </tr> + </table> + </td> <td class="listr"> <?php if (is_cert_revoked($cert)): ?> <b>Revoked</b><br/> diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index ff80bd3..35521f9 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. */ /* - pfSense_BUILDER_BINARIES: /usr/bin/tar + pfSense_BUILDER_BINARIES: /usr/bin/tar pfSense_MODULE: firmware */ @@ -68,11 +68,11 @@ function file_is_for_platform($filename, $ul_name) { if(stristr($ul_name, "nanobsd")) return true; else - return false; + return false; } $_gb = exec("/usr/bin/tar xzf $filename -C /tmp/ etc/platform"); unset($_gb); - if(!file_exists("/tmp/etc/platform")) + if(!file_exists("/tmp/etc/platform")) return false; $upgrade_is_for_platform = trim(file_get_contents("/tmp/etc/platform", " \n\t\r")); if ($g['platform'] == $upgrade_is_for_platform) { @@ -83,24 +83,24 @@ function file_is_for_platform($filename, $ul_name) { } function file_upload_error_message($error_code) { - switch ($error_code) { - case UPLOAD_ERR_INI_SIZE: - return gettext('The uploaded file exceeds the upload_max_filesize directive in php.ini'); - case UPLOAD_ERR_FORM_SIZE: - return gettext('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); - case UPLOAD_ERR_PARTIAL: - return gettext('The uploaded file was only partially uploaded'); - case UPLOAD_ERR_NO_FILE: - return gettext('No file was uploaded'); - case UPLOAD_ERR_NO_TMP_DIR: - return gettext('Missing a temporary folder'); - case UPLOAD_ERR_CANT_WRITE: - return gettext('Failed to write file to disk'); - case UPLOAD_ERR_EXTENSION: - return gettext('File upload stopped by extension'); - default: - return gettext('Unknown upload error'); - } + switch ($error_code) { + case UPLOAD_ERR_INI_SIZE: + return gettext('The uploaded file exceeds the upload_max_filesize directive in php.ini'); + case UPLOAD_ERR_FORM_SIZE: + return gettext('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); + case UPLOAD_ERR_PARTIAL: + return gettext('The uploaded file was only partially uploaded'); + case UPLOAD_ERR_NO_FILE: + return gettext('No file was uploaded'); + case UPLOAD_ERR_NO_TMP_DIR: + return gettext('Missing a temporary folder'); + case UPLOAD_ERR_CANT_WRITE: + return gettext('Failed to write file to disk'); + case UPLOAD_ERR_EXTENSION: + return gettext('File upload stopped by extension'); + default: + return gettext('Unknown upload error'); + } } /* if upgrade in progress, alert user */ @@ -118,7 +118,7 @@ if(is_subsystem_dirty('firmwarelock')) { exit; } -if($_POST['backupbeforeupgrade']) +if($_POST['backupbeforeupgrade']) touch("/tmp/perform_full_backup.txt"); if ($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltypes))) @@ -126,7 +126,7 @@ if ($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltyp /* Handle manual upgrade */ if ($_POST && !is_subsystem_dirty('firmwarelock')) { - + unset($input_errors); unset($sig_warning); @@ -149,7 +149,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { clear_subsystem_dirty('firmware'); } else if ($mode == "upgrade") { if ($_FILES['ulfile']['error']) - $errortext = "(" . file_upload_error_message($_FILES['ulfile']['error']) . ")"; + $errortext = "(" . file_upload_error_message($_FILES['ulfile']['error']) . ")"; if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) { /* verify firmware image(s) */ if (file_is_for_platform($_FILES['ulfile']['tmp_name'], $_FILES['ulfile']['name']) == false && !$_POST['sig_override']) @@ -211,7 +211,7 @@ $pgtitle = array(gettext("System"),gettext("Firmware")); include("head.inc"); ?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <form action="system_firmware.php" method="post" enctype="multipart/form-data"> <?php /* Construct an upload_id for this session */ @@ -220,7 +220,7 @@ include("head.inc"); else $upload_id = session_id(); ?> -<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo $upload_id;?>" /> +<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo $upload_id;?>" /> <?php include("fbegin.inc"); ?> <?php if ($input_errors) print_input_errors($input_errors); ?> <?php if ($savemsg) print_info_box($savemsg); ?> @@ -258,12 +258,12 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) <td> <div id="mainarea"> <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> + <tr> <td colspan="2" class="listtopic"><?=gettext("Invoke") ." ". $g['product_name'] ." ". gettext("Manual Upgrade"); ?></td> </tr> <tr> - <td width="22%" valign="baseline" class="vncell"> </td> - <td width="78%" class="vtable"> + <td width="22%" valign="baseline" class="vncell"> </td> + <td width="78%" class="vtable"> <?php if (!is_subsystem_dirty('rebootreq')): ?> <?php if (!is_subsystem_dirty('firmware')): ?> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Enable firmware upload");?>"> @@ -271,24 +271,24 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) <?php printf(gettext('Click "Enable firmware upload" to begin.'),$g['firmware_update_text']);?> <br/> <?php else: ?> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Disable firmware upload");?>"> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Disable firmware upload");?>"> </td> </tr> <tr> - <td width="22%" valign="baseline" class="vncell"> </td> - <td width="78%" class="vtable"> - <?php - if ($g['platform'] == "nanobsd") - $type = "*.img.gz"; + <td width="22%" valign="baseline" class="vncell"> </td> + <td width="78%" class="vtable"> + <?php + if ($g['platform'] == "nanobsd") + $type = "*.img.gz"; else - $type = "*.tgz"; - ?> + $type = "*.tgz"; + ?> <strong><?=gettext("Firmware image file ($type):");?> </strong> <input name="ulfile" type="file" class="formfld"> <br> <?php - if(!file_exists("/boot/kernel/pfsense_kernel.txt")) { - if($g['platform'] == "pfSense") { + if(!file_exists("/boot/kernel/pfsense_kernel.txt")) { + if($g['platform'] == "pfSense") { echo gettext("Please select kernel type") , ": "; echo "<select name='kerneltype'>"; foreach($kerneltypes as $kerntype => $kerndescr) { @@ -299,8 +299,10 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) } } ?> + <?php if ($g['hidebackupbeforeupgrade'] === false): ?> <input type="checkbox" name='backupbeforeupgrade' id='backupbeforeupgrade'> <?=gettext("Perform full backup prior to upgrade");?> <br> + <?php endif; ?> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Upgrade firmware");?>"> <?=gettext('Click "Upgrade firmware" to start the upgrade process.');?> <?php endif; else: ?> @@ -321,8 +323,8 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) </strong> </span> <?=gettext("DO NOT abort the firmware upgrade once it " . - "has started. The firewall will reboot automatically after " . - "storing the new firmware. The configuration will be maintained.");?> + "has started. The firewall will reboot automatically after " . + "storing the new firmware. The configuration will be maintained.");?> </span> <?php endif; ?> </td> diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php index 88b42f0..b2cba9f 100755 --- a/usr/local/www/system_firmware_auto.php +++ b/usr/local/www/system_firmware_auto.php @@ -5,8 +5,8 @@ Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com> Copyright (C) 2005 Scott Ullrich - Based originally on system_firmware.php - (C)2003-2004 Manuel Kasper + Based originally on system_firmware.php + (C)2003-2004 Manuel Kasper All rights reserved. Redistribution and use in source and binary forms, with or without @@ -54,9 +54,9 @@ if(isset($curcfg['alturl']['enable'])) else $updater_url = $g['update_url']; -if($_POST['backupbeforeupgrade']) +if($_POST['backupbeforeupgrade']) touch("/tmp/perform_full_backup.txt"); - + $pgtitle = array(gettext("Diagnostics"),gettext("Firmware"),gettext("Auto Update")); include("head.inc"); @@ -74,53 +74,55 @@ include("head.inc"); <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php"); - $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php"); - $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php"); - if($g['hidedownloadbackup'] == false) - $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php"); - display_top_tabs($tab_array); -?> + <?php + $tab_array = array(); + $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php"); + $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php"); + $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php"); + if($g['hidedownloadbackup'] == false) + $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php"); + display_top_tabs($tab_array); + ?> </td> </tr> <tr> - <td class="tabcont"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="tabcont"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td> - <center> - <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> - - <tr> - <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'> - </td> - <td> - <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'> - <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left"> - <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'> - </td> + <td class="tabcont"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="tabcont"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td> + <center> + <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + + <tr> + <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'> + </td> + <td> + <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left"> + <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'> + </td> + </table> + </td> + <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'> + </td> + </tr> </table> - </td> - <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'> + <br> + <!-- status box --> + <textarea cols="90" rows="1" name="status" id="status" wrap="hard"><?=gettext("Beginning firmware upgrade"); ?>.</textarea> + <!-- command output box --> + <textarea cols="90" rows="25" name="output" id="output" wrap="hard"></textarea> + </center> </td> </tr> </table> - <br> - <!-- status box --> - <textarea cols="90" rows="1" name="status" id="status" wrap="hard"><?=gettext("Beginning firmware upgrade"); ?>.</textarea> - <!-- command output box --> - <textarea cols="90" rows="25" name="output" id="output" wrap="hard"></textarea> - </center> </td> </tr> - </table> - </table> - </td> + </table> + </td> </tr> </table> </form> @@ -166,7 +168,7 @@ if(!$latest_version) { } else { $update_filename = "latest.tgz"; } - $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware"); + $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware"); $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}.sha256", "{$g['upload_path']}/latest.tgz.sha256"); conf_mount_ro(); update_output_window("{$g['product_name']} " . gettext("download complete.")); @@ -210,13 +212,13 @@ if ($sigchk == 1) { } if ($exitstatus) { - update_status($sig_warning); - update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab.")); - require("fend.inc"); - exit; + update_status($sig_warning); + update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab.")); + require("fend.inc"); + exit; } else if ($sigchk == 2) { - update_status("Upgrade in progress..."); - update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n"); + update_status("Upgrade in progress..."); + update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n"); } if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) { diff --git a/usr/local/www/system_firmware_check.php b/usr/local/www/system_firmware_check.php index 8aaa5a3..c69ce68 100755 --- a/usr/local/www/system_firmware_check.php +++ b/usr/local/www/system_firmware_check.php @@ -61,54 +61,56 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php"); - $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php"); - $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php"); - if($g['hidedownloadbackup'] == false) - $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php"); - display_top_tabs($tab_array); -?> + <?php + $tab_array = array(); + $tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php"); + $tab_array[] = array(gettext("Auto Update"), true, "system_firmware_check.php"); + $tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php"); + if($g['hidedownloadbackup'] == false) + $tab_array[] = array(gettext("Restore Full Backup"), false, "system_firmware_restorefullbackup.php"); + display_top_tabs($tab_array); + ?> </td> </tr> <tr> - <td class="tabcont"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td> - <!-- progress bar --> - <center> - <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + <td class="tabcont"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td> + <!-- progress bar --> + <center> + <table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> <tr> <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'> </td> <td> - <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'> - <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left"> + <table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left"> <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'> - </td> - </table> - </td> - <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'> - </td> - </tr> - </table> - <br> - <!-- command output box --> - <textarea border='1' bordercolordark='#000000' bordercolorlight='#000000' cols='90' rows='9' name='output' id='output' wrap='hard'> - </textarea> - <div id='backupdiv' name='backupdiv' style='visibility:hidden'> - <br/><input type="checkbox" name='backupbeforeupgrade' id='backupbeforeupgrade'> <?=gettext("Perform full backup prior to upgrade");?> - </div> - </center> - <p> - <center><input id='invokeupgrade' style='visibility:hidden' type="submit" value="<?=gettext("Invoke Auto Upgrade"); ?>"> - </td> - </tr> - </table> - </td> + </td> + </table> + </td> + <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'> + </td> + </tr> + </table> + <br> + <!-- command output box --> + <textarea border='1' bordercolordark='#000000' bordercolorlight='#000000' cols='90' rows='9' name='output' id='output' wrap='hard'> + </textarea> + <div id='backupdiv' name='backupdiv' style='visibility:hidden'> + <?php if ($g['hidebackupbeforeupgrade'] === false): ?> + <br/><input type="checkbox" name='backupbeforeupgrade' id='backupbeforeupgrade'> <?=gettext("Perform full backup prior to upgrade");?> + <?php endif; ?> + </div> + </center> + <p> + <center><input id='invokeupgrade' style='visibility:hidden' type="submit" value="<?=gettext("Invoke Auto Upgrade"); ?>"></center> + </td> + </tr> + </table> + </td> </tr> </table> diff --git a/usr/local/www/system_firmware_restorefullbackup.php b/usr/local/www/system_firmware_restorefullbackup.php index 2c15c9a..c23b45e 100755 --- a/usr/local/www/system_firmware_restorefullbackup.php +++ b/usr/local/www/system_firmware_restorefullbackup.php @@ -52,18 +52,18 @@ require("guiconfig.inc"); require_once("filter.inc"); require_once("shaper.inc"); -if($_POST['overwriteconfigxml']) +if($_POST['overwriteconfigxml']) touch("/tmp/do_not_restore_config.xml"); -if($_GET['backupnow']) +if($_GET['backupnow']) mwexec_bg("/etc/rc.create_full_backup"); if($_GET['downloadbackup']) { $filename = $_GET['downloadbackup']; $path = "/root/{$filename}"; if(file_exists("/root/{$filename}")) { - session_write_close(); - ob_end_clean(); + session_write_close(); + ob_end_clean(); session_cache_limiter('public'); //$fd = fopen("/root/{$filename}", "rb"); $filesize = filesize("/root/{$filename}"); @@ -74,11 +74,11 @@ if($_GET['downloadbackup']) { header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Content-Transfer-Encoding: binary\n"); if($file = fopen("/root/{$filename}", 'rb')){ - while( (!feof($file)) && (connection_status()==0) ){ - print(fread($file, 1024*8)); - flush(); - } - fclose($file); + while( (!feof($file)) && (connection_status()==0) ){ + print(fread($file, 1024*8)); + flush(); + } + fclose($file); } exit; @@ -175,13 +175,13 @@ include("head.inc"); echo "</td>"; echo "</tr>"; } - ?> +?> <tr> <td width="78%" colspan="3"> <br/> <input type="checkbox" name="overwriteconfigxml" id="overwriteconfigxml" CHECKED> do not restore config.xml. <p/> - <input name="Restore" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore"); ?>"> + <input name="Restore" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore"); ?>"> </td> </tr> </table> diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 7fcfb97..2927aac 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -1,22 +1,22 @@ -<?php +<?php /* $Id$ */ /* system_gateways_edit.php part of pfSense (http://pfsense.com) - + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -50,8 +50,8 @@ foreach($a_gateways as $gw) { $a_gateways = $a_gateways_arr; if (!is_array($config['gateways']['gateway_item'])) - $config['gateways']['gateway_item'] = array(); - + $config['gateways']['gateway_item'] = array(); + $a_gateway_item = &$config['gateways']['gateway_item']; $apinger_default = return_apinger_defaults(); @@ -379,13 +379,13 @@ if ($_POST) { if ($_POST['latencylow']) $gateway['latencylow'] = $_POST['latencylow']; if ($_POST['latencyhigh']) - $gateway['latencyhigh'] = $_POST['latencyhigh']; + $gateway['latencyhigh'] = $_POST['latencyhigh']; if ($_POST['losslow']) $gateway['losslow'] = $_POST['losslow']; if ($_POST['losshigh']) - $gateway['losshigh'] = $_POST['losshigh']; + $gateway['losshigh'] = $_POST['losshigh']; if ($_POST['down']) - $gateway['down'] = $_POST['down']; + $gateway['down'] = $_POST['down']; /* when saving the manual gateway we use the attribute which has the corresponding id */ if (isset($id) && $a_gateway_item[$id]) @@ -394,7 +394,7 @@ if ($_POST) { $a_gateway_item[] = $gateway; mark_subsystem_dirty('staticroutes'); - + write_config(); if($_REQUEST['isAjax']) { @@ -402,7 +402,7 @@ if ($_POST) { exit; } else if (!empty($reloadif)) send_event("interface reconfigure {$reloadif}"); - + header("Location: system_gateways.php"); exit; } else { @@ -414,7 +414,7 @@ if ($_POST) { } exit; } - + $pconfig = $_POST; if (empty($_POST['friendlyiface'])) $pconfig['friendlyiface'] = $_POST['interface']; @@ -433,16 +433,16 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <script language="JavaScript"> function show_advanced_gateway() { - document.getElementById("showadvgatewaybox").innerHTML=''; - aodiv = document.getElementById('showgatewayadv'); - aodiv.style.display = "block"; + document.getElementById("showadvgatewaybox").innerHTML=''; + aodiv = document.getElementById('showgatewayadv'); + aodiv.style.display = "block"; } function monitor_change() { - document.iform.monitor.disabled = document.iform.monitor_disable.checked; + document.iform.monitor.disabled = document.iform.monitor_disable.checked; } </script> <?php if ($input_errors) print_input_errors($input_errors); ?> - <form action="system_gateways_edit.php" method="post" name="iform" id="iform"> + <form action="system_gateways_edit.php" method="post" name="iform" id="iform"> <?php /* If this is a system gateway we need this var */ @@ -451,187 +451,192 @@ function monitor_change() { } echo "<input type='hidden' name='friendlyiface' id='friendlyiface' value='" . htmlspecialchars($pconfig['friendlyiface']) . "' >\n"; ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td colspan="2" valign="top" class="listtopic"><?=gettext("Edit gateway"); ?></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td> - <td width="78%" class="vtable"> - <select name='interface' class='formselect' > - - <?php - $interfaces = get_configured_interface_with_descr(false, true); - foreach ($interfaces as $iface => $ifacename) { - echo "<option value=\"{$iface}\""; - if ($iface == $pconfig['friendlyiface']) - echo " selected"; - echo ">" . htmlspecialchars($ifacename) . "</option>"; - } - if (is_package_installed("openbgpd") == 1) { - echo "<option value=\"bgpd\""; - if ($pconfig['interface'] == "bgpd") - echo " selected"; - echo ">" . gettext("Use BGPD") . "</option>"; - } - ?> - </select> <br> - <span class="vexpl"><?=gettext("Choose which interface this gateway applies to."); ?></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Address Family"); ?></td> - <td width="78%" class="vtable"> - <select name='ipprotocol' class='formselect' > - <?php - $options = array("inet" => "IPv4", "inet6" => "IPv6"); - foreach ($options as $name => $string) { - echo "<option value=\"{$name}\""; - if ($name == $pconfig['ipprotocol']) - echo " selected"; - echo ">" . htmlspecialchars($string) . "</option>\n"; - } - ?> - </select> <br> - <span class="vexpl"><?=gettext("Choose the Internet Protocol this gateway uses."); ?></span></td> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"> - <br> <span class="vexpl"><?=gettext("Gateway name"); ?></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td> - <td width="78%" class="vtable"> - <input name="gateway" type="text" class="formfld host" id="gateway" size="28" value="<?php if ($pconfig['dynamic']) echo "dynamic"; else echo htmlspecialchars($pconfig['gateway']); ?>"> - <br> <span class="vexpl"><?=gettext("Gateway IP address"); ?></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Default Gateway"); ?></td> - <td width="78%" class="vtable"> - <input name="defaultgw" type="checkbox" id="defaultgw" value="yes" <?php if ($pconfig['defaultgw'] == true) echo "checked"; ?> /> - <strong><?=gettext("Default Gateway"); ?></strong><br /> - <?=gettext("This will select the above gateway as the default gateway"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Disable Gateway Monitoring"); ?></td> - <td width="78%" class="vtable"> - <input name="monitor_disable" type="checkbox" id="monitor_disable" value="yes" <?php if ($pconfig['monitor_disable'] == true) echo "checked"; ?> onClick="monitor_change()" /> - <strong><?=gettext("Disable Gateway Monitoring"); ?></strong><br /> - <?=gettext("This will consider this gateway as always being up"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td> - <td width="78%" class="vtable"> - <?php - if ($pconfig['gateway'] == $pconfig['monitor']) - $monitor = ""; - else - $monitor = htmlspecialchars($pconfig['monitor']); - ?> - <input name="monitor" type="text" id="monitor" value="<?php echo htmlspecialchars($monitor); ?>" size="28" /> - <strong><?=gettext("Alternative monitor IP"); ?></strong> <br /> - <?=gettext("Enter an alternative address here to be used to monitor the link. This is used for the " . - "quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond " . - "to ICMP echo requests (pings)"); ?>.</strong> - <br /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Advanced");?></td> - <td width="78%" class="vtable"> - <?php $showbutton = (!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (isset($pconfig['interval']) && ($pconfig['interval'] > $apinger_default['interval'])) || (isset($pconfig['down']) && !($pconfig['down'] == $apinger_default['down']))); ?> - <div id="showadvgatewaybox" <?php if ($showbutton) echo "style='display:none'"; ?>> - <input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a> - </div> - <div id="showgatewayadv" <?php if (!$showbutton) echo "style='display:none'"; ?>> - <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Edit gateway"); ?></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td> + <td width="78%" class="vtable"> + <select name='interface' class='formselect' > + <?php + $interfaces = get_configured_interface_with_descr(false, true); + foreach ($interfaces as $iface => $ifacename) { + echo "<option value=\"{$iface}\""; + if ($iface == $pconfig['friendlyiface']) + echo " selected"; + echo ">" . htmlspecialchars($ifacename) . "</option>"; + } + if (is_package_installed("openbgpd") == 1) { + echo "<option value=\"bgpd\""; + if ($pconfig['interface'] == "bgpd") + echo " selected"; + echo ">" . gettext("Use BGPD") . "</option>"; + } + ?> + </select> <br> + <span class="vexpl"><?=gettext("Choose which interface this gateway applies to."); ?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Address Family"); ?></td> + <td width="78%" class="vtable"> + <select name='ipprotocol' class='formselect' > + <?php + $options = array("inet" => "IPv4", "inet6" => "IPv6"); + foreach ($options as $name => $string) { + echo "<option value=\"{$name}\""; + if ($name == $pconfig['ipprotocol']) + echo " selected"; + echo ">" . htmlspecialchars($string) . "</option>\n"; + } + ?> + </select> <br> + <span class="vexpl"><?=gettext("Choose the Internet Protocol this gateway uses."); ?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td> + <td width="78%" class="vtable"> + <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"> + <br> <span class="vexpl"><?=gettext("Gateway name"); ?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td> + <td width="78%" class="vtable"> + <input name="gateway" type="text" class="formfld host" id="gateway" size="28" value="<?php if ($pconfig['dynamic']) echo "dynamic"; else echo htmlspecialchars($pconfig['gateway']); ?>"> + <br> <span class="vexpl"><?=gettext("Gateway IP address"); ?></span> + </td> + </tr> <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td> - <td width="78%" class="vtable"> - <select name='weight' class='formfldselect' id='weight'> - <?php - for ($i = 1; $i < 6; $i++) { - $selected = ""; - if ($pconfig['weight'] == $i) - $selected = "selected"; - echo "<option value='{$i}' {$selected} >{$i}</option>"; - } - ?> - </select> - <br /><?=gettext("Weight for this gateway when used in a Gateway Group.");?> <br /> - </td> + <td width="22%" valign="top" class="vncell"><?=gettext("Default Gateway"); ?></td> + <td width="78%" class="vtable"> + <input name="defaultgw" type="checkbox" id="defaultgw" value="yes" <?php if ($pconfig['defaultgw'] == true) echo "checked"; ?> /> + <strong><?=gettext("Default Gateway"); ?></strong><br /> + <?=gettext("This will select the above gateway as the default gateway"); ?> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Disable Gateway Monitoring"); ?></td> + <td width="78%" class="vtable"> + <input name="monitor_disable" type="checkbox" id="monitor_disable" value="yes" <?php if ($pconfig['monitor_disable'] == true) echo "checked"; ?> onClick="monitor_change()" /> + <strong><?=gettext("Disable Gateway Monitoring"); ?></strong><br /> + <?=gettext("This will consider this gateway as always being up"); ?> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td> + <td width="78%" class="vtable"> + <?php + if ($pconfig['gateway'] == $pconfig['monitor']) + $monitor = ""; + else + $monitor = htmlspecialchars($pconfig['monitor']); + ?> + <input name="monitor" type="text" id="monitor" value="<?php echo htmlspecialchars($monitor); ?>" size="28" /> + <strong><?=gettext("Alternative monitor IP"); ?></strong> <br /> + <?=gettext("Enter an alternative address here to be used to monitor the link. This is used for the " . + "quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond " . + "to ICMP echo requests (pings)"); ?>.</strong> + <br /> + </td> </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td> - <td width="78%" class="vtable"> - <?=gettext("From");?> - <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" - value="<?=htmlspecialchars($pconfig['latencylow']);?>"> - <?=gettext("To");?> - <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" - value="<?=htmlspecialchars($pconfig['latencyhigh']);?>"> - <br> <span class="vexpl"><?=gettext(sprintf("Low and high thresholds for latency in milliseconds. Default is %d/%d.", $apinger_default['latencylow'], $apinger_default['latencyhigh']));?></span></td> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td> - <td width="78%" class="vtable"> - <?=gettext("From");?> - <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" - value="<?=htmlspecialchars($pconfig['losslow']);?>"> - <?=gettext("To");?> - <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" - value="<?=htmlspecialchars($pconfig['losshigh']);?>"> - <br> <span class="vexpl"><?=gettext(sprintf("Low and high thresholds for packet loss in %%. Default is %d/%d.", $apinger_default['losslow'], $apinger_default['losshigh']));?></span></td> - </td> - </tr> <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Frequency Probe");?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("Advanced");?></td> <td width="78%" class="vtable"> - <input name="interval" type="text" class="formfld unknown" id="interval" size="2" - value="<?=htmlspecialchars($pconfig['interval']);?>"> - <br><span class="vexpl"> - <?=gettext(sprintf("How often that an ICMP probe will be sent in seconds. Default is %d.", $apinger_default['interval']));?><br/><br/> - <?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the frequency probe is increased the accuracy of the quality graph is decreased.");?> - </span></td> + <?php $showbutton = (!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (isset($pconfig['interval']) && ($pconfig['interval'] > $apinger_default['interval'])) || (isset($pconfig['down']) && !($pconfig['down'] == $apinger_default['down']))); ?> + <div id="showadvgatewaybox" <?php if ($showbutton) echo "style='display:none'"; ?>> + <input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a> + </div> + <div id="showgatewayadv" <?php if (!$showbutton) echo "style='display:none'"; ?>> + <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td> + <td width="78%" class="vtable"> + <select name='weight' class='formfldselect' id='weight'> + <?php + for ($i = 1; $i < 6; $i++) { + $selected = ""; + if ($pconfig['weight'] == $i) + $selected = "selected"; + echo "<option value='{$i}' {$selected} >{$i}</option>"; + } + ?> + </select> + <br /><?=gettext("Weight for this gateway when used in a Gateway Group.");?> <br /> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td> + <td width="78%" class="vtable"> + <?=gettext("From");?> + <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" + value="<?=htmlspecialchars($pconfig['latencylow']);?>"> + <?=gettext("To");?> + <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" + value="<?=htmlspecialchars($pconfig['latencyhigh']);?>"> + <br> <span class="vexpl"><?=gettext(sprintf("Low and high thresholds for latency in milliseconds. Default is %d/%d.", $apinger_default['latencylow'], $apinger_default['latencyhigh']));?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td> + <td width="78%" class="vtable"> + <?=gettext("From");?> + <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" + value="<?=htmlspecialchars($pconfig['losslow']);?>"> + <?=gettext("To");?> + <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" + value="<?=htmlspecialchars($pconfig['losshigh']);?>"> + <br> <span class="vexpl"><?=gettext(sprintf("Low and high thresholds for packet loss in %%. Default is %d/%d.", $apinger_default['losslow'], $apinger_default['losshigh']));?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Frequency Probe");?></td> + <td width="78%" class="vtable"> + <input name="interval" type="text" class="formfld unknown" id="interval" size="2" + value="<?=htmlspecialchars($pconfig['interval']);?>"> + <br><span class="vexpl"> + <?=gettext(sprintf("How often that an ICMP probe will be sent in seconds. Default is %d.", $apinger_default['interval']));?><br/><br/> + <?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the frequency probe is increased the accuracy of the quality graph is decreased.");?> + </span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Down");?></td> + <td width="78%" class="vtable"> + <input name="down" type="text" class="formfld unknown" id="down" size="2" + value="<?=htmlspecialchars($pconfig['down']);?>"> + <br> <span class="vexpl"><?=gettext(sprintf("The number of seconds of failed probes before the alarm will fire. Default is %d.", $apinger_default['down']));?></span> + </td> + </tr> + <tr> + <td colspan="2"> + <?= gettext("NOTE: The Frequency Probe interval must be less than the Down time, otherwise the gateway will seem to go down then come up again at the next probe."); ?><br/> + </td> + </tr> + </table> + </div> </td> </tr> <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Down");?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> <td width="78%" class="vtable"> - <input name="down" type="text" class="formfld unknown" id="down" size="2" - value="<?=htmlspecialchars($pconfig['down']);?>"> - <br> <span class="vexpl"><?=gettext(sprintf("The number of seconds of failed probes before the alarm will fire. Default is %d.", $apinger_default['down']));?></span></td> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span> </td> </tr> <tr> - <td colspan="2"> - <?= gettext("NOTE: The Frequency Probe interval must be less than the Down time, otherwise the gateway will seem to go down then come up again at the next probe."); ?><br/> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input type="button" value="<?=gettext("Cancel");?>" class="formbtn" onclick="history.back()"> + <?php if (isset($id) && $a_gateways[$id]): ?> + <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>"> + <?php endif; ?> </td> </tr> - </table> - </div> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> - <td width="78%" class="vtable"> - <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> - <br> <span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span></td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input type="button" value="<?=gettext("Cancel");?>" class="formbtn" onclick="history.back()"> - <?php if (isset($id) && $a_gateways[$id]): ?> - <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>"> - <?php endif; ?> - </td> - </tr> - </table> -</form> + </table> + </form> <?php include("fend.inc"); ?> <script language="JavaScript"> monitor_change(); diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index a77ba09..d13a5a7 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -332,10 +332,10 @@ function step3_stepbeforeformdisplay() { $voipfields[] = $field; $field = array(); - $field['name'] = "Address"; - $enablefields[] = "Address"; + $field['name'] = "Upstream SIP Server"; + $enablefields[] = "Upstream SIP Server"; $field['type'] = "inputalias"; - $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location."; + $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location."; $field['message'] = "IP Address field is non-blank and doesn't look like an IP address."; $field['bindstofield'] = "ezshaper->step3->address"; $voipfields[] = $field; @@ -1359,9 +1359,9 @@ function apply_all_choosen_items() { if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { /* create VOIP rules */ $rule = array(); - $rule['type'] = "match"; + $rule['type'] = "match"; //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("VOIP Adapter"); + $rule['descr'] = gettext("Connections From Upstream SIP Server"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; $rule['source']['address'] = $config['ezshaper']['step3']['address']; @@ -1370,7 +1370,19 @@ function apply_all_choosen_items() { $rule['wizard'] = "yes"; $rule['enabled'] = "on"; $config['filter']['rule'][] = $rule; - + + $rule = array(); + $rule['type'] = "match"; + //$rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Connections To Upstream SIP Server"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['any'] = TRUE; + $rule['destination']['address'] = $config['ezshaper']['step3']['address']; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ $rule = array(); diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml index 8a53afe..60c9986 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard.xml @@ -115,9 +115,9 @@ </options> </field> <field> - <name>Address</name> + <name>Upstream SIP Server</name> <type>inputalias</type> - <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description> + <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location.</description> <bindstofield>ezshaper->step3->address</bindstofield> <message>IP Address field is non-blank and doesn't look like an IP address.</message> </field> diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index c721b02..2cc43e2 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -357,10 +357,10 @@ function step3_stepbeforeformdisplay() { $voipfields[] = $field; $field = array(); - $field['name'] = "Address"; - $enablefields[] = "Address"; + $field['name'] = "Upstream SIP Server"; + $enablefields[] = "Upstream SIP Server"; $field['type'] = "inputalias"; - $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location."; + $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location."; $field['message'] = "IP Address field is non-blank and doesn't look like an IP address."; $field['bindstofield'] = "ezshaper->step3->address"; $voipfields[] = $field; @@ -1423,8 +1423,8 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("VOIP Adapter"); + //$rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Connections From Upstream SIP Server"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; $rule['source']['address'] = $config['ezshaper']['step3']['address']; @@ -1434,6 +1434,19 @@ function apply_all_choosen_items() { $rule['enabled'] = "on"; $config['filter']['rule'][] = $rule; + $rule = array(); + $rule['type'] = "match"; + //$rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Connections To Upstream SIP Server"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['any'] = TRUE; + $rule['destination']['address'] = $config['ezshaper']['step3']['address']; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ $rule = array(); diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml index abeb31a..1c3aa40 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml @@ -120,9 +120,9 @@ </options> </field> <field> - <name>Address</name> + <name>Upstream SIP Server</name> <type>inputalias</type> - <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description> + <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location.</description> <bindstofield>ezshaper->step3->address</bindstofield> <message>IP Address field is non-blank and doesn't look like an IP address.</message> </field> diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 42f6ddb..707463d 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -379,10 +379,10 @@ function step3_stepbeforeformdisplay() { $voipfields[] = $field; $field = array(); - $field['name'] = "Address"; - $enablefields[] = "Address"; + $field['name'] = "Upstream SIP Server"; + $enablefields[] = "Upstream SIP Server"; $field['type'] = "inputalias"; - $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location."; + $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location."; $field['message'] = "IP Address field is non-blank and doesn't look like an IP address."; $field['bindstofield'] = "ezshaper->step3->address"; $voipfields[] = $field; @@ -1480,8 +1480,8 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("VOIP Adapter"); + //$rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Connections From Upstream SIP Server"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; $rule['source']['address'] = $config['ezshaper']['step3']['address']; @@ -1490,6 +1490,19 @@ function apply_all_choosen_items() { $rule['wizard'] = "yes"; $rule['enabled'] = "on"; $config['filter']['rule'][] = $rule; + + $rule = array(); + $rule['type'] = "match"; + //$rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Connections To Upstream SIP Server"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['any'] = TRUE; + $rule['destination']['address'] = $config['ezshaper']['step3']['address']; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml index 3ee5772..8ea3d0f 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml @@ -128,9 +128,9 @@ </options> </field> <field> - <name>Address</name> + <name>Upstream SIP Server</name> <type>inputalias</type> - <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description> + <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location.</description> <bindstofield>ezshaper->step3->address</bindstofield> <message>IP Address field is non-blank and doesn't look like an IP address.</message> </field> diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc index bde56bb..95a4d94 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc @@ -1221,8 +1221,8 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; - //$rule['interface'] = "wan"; - $rule['descr'] = gettext("VOIP Adapter"); + //$rule['interface'] = "wan"; + $rule['descr'] = gettext("Connections From Upstream SIP Server"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; $rule['source']['address'] = $config['ezshaper']['step3']['address']; @@ -1232,6 +1232,19 @@ function apply_all_choosen_items() { $rule['enabled'] = "on"; $config['filter']['rule'][] = $rule; + $rule = array(); + $rule['type'] = "match"; + //$rule['interface'] = "wan"; + $rule['descr'] = gettext("Connections To Upstream SIP Server"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['any'] = TRUE; + $rule['destination']['address'] = $config['ezshaper']['step3']['address']; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ $rule = array(); diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml index 6a1797b..e28d210 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml @@ -117,9 +117,9 @@ </options> </field> <field> - <name>Address</name> + <name>Upstream SIP Server</name> <type>inputalias</type> - <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description> + <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location.</description> <bindstofield>ezshaper->step3->address</bindstofield> <message>IP Address field is non-blank and doesn't look like an IP address.</message> </field> |