diff options
author | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-12 12:55:32 -0300 |
---|---|---|
committer | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-12 12:55:32 -0300 |
commit | e73b001e2585b55973faaf0be199a5f438c4ae89 (patch) | |
tree | 6dc08100313fe95ab4ca2dfa9883c23152dd4538 /usr/local | |
parent | 3e6ec5dfba9679f6b521962269aca9570e391abb (diff) | |
parent | 3e4f5a3359ebcc46710f37466620d0c0cdfd7293 (diff) | |
download | pfsense-e73b001e2585b55973faaf0be199a5f438c4ae89.zip pfsense-e73b001e2585b55973faaf0be199a5f438c4ae89.tar.gz |
Merge remote branch 'mainline/master'
Conflicts:
usr/local/www/diag_smart.php
usr/local/www/firewall_rules_edit.php
usr/local/www/interfaces.php
usr/local/www/load_balancer_pool_edit.php
usr/local/www/pkg_mgr_settings.php
Diffstat (limited to 'usr/local')
33 files changed, 305 insertions, 262 deletions
diff --git a/usr/local/www/diag_confbak.php b/usr/local/www/diag_confbak.php index c865115..f02d2de 100755 --- a/usr/local/www/diag_confbak.php +++ b/usr/local/www/diag_confbak.php @@ -46,7 +46,7 @@ if($_GET['newver'] != "") { $confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); if(config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) - $savemsg = sprintf(gettext("Successfully reverted to timestamp %s with description \"%s\"."), date(gettext("n/j/y H:i:s"), $_GET['newver']), $confvers[$_GET['newver']]['description']); + $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['newver']), $confvers[$_GET['newver']]['description']); else $savemsg = gettext("Unable to revert to the selected configuration."); conf_mount_ro(); @@ -56,7 +56,7 @@ if($_GET['rmver'] != "") { conf_mount_rw(); $confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml'); - $savemsg = sprintf(gettext("Deleted backup with timestamp %s and description \"%s\"."), date(gettext("n/j/y H:i:s"), $_GET['rmver']),$confvers[$_GET['rmver']]['description']); + $savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['rmver']),$confvers[$_GET['rmver']]['description']); conf_mount_ro(); } diff --git a/usr/local/www/diag_logs_filter_summary.php b/usr/local/www/diag_logs_filter_summary.php index 1171b89..96a2ecd 100644 --- a/usr/local/www/diag_logs_filter_summary.php +++ b/usr/local/www/diag_logs_filter_summary.php @@ -204,7 +204,7 @@ include("head.inc"); ?> </td></tr> <tr><td align="center"> -<?php printf (gettext("This is a firewall log summary, of the last %s lines of the firewall log (Max %s)."), $gotlines, $lines)?><br /> +<?php printf (gettext('This is a firewall log summary, of the last %1$s lines of the firewall log (Max %2$s).'), $gotlines, $lines)?><br /> <?=gettext("NOTE: IE8 users must enable compatibility view.")?> <?php diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php index 2af0ea3..8c36eb0 100755 --- a/usr/local/www/diag_logs_vpn.php +++ b/usr/local/www/diag_logs_vpn.php @@ -131,7 +131,7 @@ include("head.inc"); </td></tr> <tr> <td colspan="4" class="listtopic"> - <?php printf(gettext("Last %s %s VPN log entries"),$nentries,$vpns[$vpntype]);?></td> + <?php printf(gettext('Last %1$s %2$s VPN log entries'),$nentries,$vpns[$vpntype]);?></td> </tr> <tr> <td class="listhdrr"><?=gettext("Time");?></td> diff --git a/usr/local/www/diag_pkglogs.php b/usr/local/www/diag_pkglogs.php index bf7be9e..9fb2b8f 100755 --- a/usr/local/www/diag_pkglogs.php +++ b/usr/local/www/diag_pkglogs.php @@ -112,7 +112,7 @@ include("head.inc"); <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" class="listtopic"> - <?php printf(gettext("Last %s %s log entries"),$nentries,$curtab); ?></td> + <?php printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab); ?></td> </tr> <?php $package =& $config['installedpackages']['package'][$apkgid]; diff --git a/usr/local/www/diag_smart.php b/usr/local/www/diag_smart.php index 8c3c6a0..690155e 100644 --- a/usr/local/www/diag_smart.php +++ b/usr/local/www/diag_smart.php @@ -206,6 +206,7 @@ switch($action) <td colspan="2" valign="top" class="listtopic"><?=gettext("Config"); ?></td> </tr> <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Email Address"); ?></td> <td width="22%" valign="top" class="vncell"><?=gettext("Email Adress"); ?></td> <td width="78%" class="vtable"> <input type="text" name="smartmonemail" value="<?=$pconfig['smartmonemail']?>"/> diff --git a/usr/local/www/diag_traceroute.php b/usr/local/www/diag_traceroute.php index 42a3925..009b2ac 100755 --- a/usr/local/www/diag_traceroute.php +++ b/usr/local/www/diag_traceroute.php @@ -63,7 +63,7 @@ if ($_POST || $_REQUEST['host']) { do_input_validation($_REQUEST, $reqdfields, $reqdfieldsn, &$input_errors); if (($_REQUEST['ttl'] < 1) || ($_REQUEST['ttl'] > MAX_TTL)) { - $input_errors[] = sprintf(gettext("Maximum number of hops must be between 1 and '%s'"), MAX_TLL); + $input_errors[] = sprintf(gettext("Maximum number of hops must be between 1 and %s"), MAX_TTL); } if (!$input_errors) { diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index b7c48e1..f66766a 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -260,7 +260,7 @@ if ($_POST) { if (!is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) - $input_errors[] = sprintf(gettext("%s is not a valid %s alias."), $_POST["address{$x}"], $_POST['type']); + $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']); } if (is_iprange($_POST["address{$x}"])) { list($startip, $endip) = explode('-', $_POST["address{$x}"]); @@ -279,7 +279,7 @@ if ($_POST) { } } if ($wrongaliases <> "") - $input_errors[] = sprintf(gettext("The alias(es): %s %scannot be nested cause they are not of the same type."), $wrongaliases, " \n"); + $input_errors[] = sprintf(gettext('The alias(es): %s cannot be nested because they are not of the same type.'), $wrongaliases); } if (!$input_errors) { diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index 4ae3720..ceded3d 100755 --- a/usr/local/www/firewall_nat_edit.php +++ b/usr/local/www/firewall_nat_edit.php @@ -775,6 +775,7 @@ include("fbegin.inc"); ?> <?php $linkedrule = ""; if (is_array($config['filter']['rule'])) { + filter_rules_sort(); foreach ($config['filter']['rule'] as $filter_id => $filter_rule) { if (isset($filter_rule['associated-rule-id'])) { echo "<option value=\"{$filter_rule['associated-rule-id']}\""; diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 84ad64d..fb59a60 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -108,7 +108,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $natent = array(); $natent['source']['network'] = "{$osn}/{$ossubnet}"; $natent['dstport'] = "500"; - $natent['descr'] = sprintf(gettext("Auto created rule for ISAKMP - %s to %s"),$ifdesc,$ifdesc2); + $natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc,$ifdesc2); $natent['target'] = ""; $natent['interface'] = $if2; $natent['destination']['any'] = true; @@ -118,7 +118,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $natent = array(); $natent['source']['network'] = "{$osn}/{$ossubnet}"; $natent['sourceport'] = ""; - $natent['descr'] = sprintf(gettext("Auto created rule for %s to %s"),$ifdesc,$ifdesc2); + $natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc,$ifdesc2); $natent['target'] = ""; $natent['interface'] = $if2; $natent['destination']['any'] = true; diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 9d5b499..3a769b7 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -51,7 +51,7 @@ require_once("shaper.inc"); $pgtitle = array(gettext("Firewall"),gettext("Rules")); -function check_for_advaned_options(&$item) { +function check_for_advanced_options(&$item) { $item_set = ""; if($item['max']) $item_set .= "max {$item['max']} "; @@ -62,9 +62,9 @@ function check_for_advaned_options(&$item) { if($item['max-src-states']) $item_set .= "max-src-states {$item['max-src-states']} "; if($item['statetype'] != "keep state" && $item['statetype'] != "") - $item_set .= "statetype {$item['statetype']} {$item['statetype']}"; + $item_set .= "statetype {$item['statetype']} "; if($item['statetimeout']) - $item_set .= "statetimeout {$item['statetimeout']}"; + $item_set .= "statetimeout {$item['statetimeout']} "; if($item['nosync']) $item_set .= "nosync "; if($item['max-src-conn-rate']) @@ -436,9 +436,9 @@ if($_REQUEST['undodrag']) { continue; if (isset($filterent['floating']) && "FloatingRules" != $if) continue; - $isadvset = check_for_advaned_options($filterent); + $isadvset = check_for_advanced_options($filterent); if($isadvset) - $advanced_set = sprintf("<img src=\"./themes/%s/images/icons/icon_advanced.gif\" title=\"%s: %s\" border=\"0\">", $g['theme'], gettext("advanced settings set"), $isadvset); + $advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\">"; else $advanced_set = "" ?> diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 6aab43b..95e844d 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -187,6 +187,12 @@ if (isset($_GET['dup'])) if ($_POST) { + if( isset($a_filter[$id]['associated-rule-id']) ) { + $_POST['proto'] = $pconfig['proto']; + if ($pconfig['proto'] == "icmp") + $_POST['icmptype'] = $pconfig['icmptype']; + } + if ($_POST['type'] == "reject" && $_POST['proto'] <> "tcp") $input_errors[] = gettext("Reject type rules only works when the protocol is set to TCP."); @@ -260,8 +266,8 @@ if ($_POST) { /* input validation */ $reqdfields = explode(" ", "type proto"); if ( isset($a_filter[$id]['associated-rule-id'])===false ) { - $redqfields[] = "src"; - $redqfields[] = "dst"; + $reqdfields[] = "src"; + $reqdfields[] = "dst"; } $reqdfieldsn = explode(",", "Type,Protocol"); if ( isset($a_filter[$id]['associated-rule-id'])===false ) { @@ -518,6 +524,14 @@ if ($_POST) { // If we have an associated nat rule, make sure the source and destination doesn't change if( isset($a_filter[$id]['associated-rule-id']) ) { $filterent['interface'] = $a_filter[$id]['interface']; + if (isset($a_filter[$id]['protocol'])) + $filterent['protocol'] = $a_filter[$id]['protocol']; + else if (isset($filterent['protocol'])) + unset($filterent['protocol']); + if ($a_filter[$id]['protocol'] == "icmp" && $a_filter[$id]['icmptype']) + $filterent['icmptype'] = $a_filter[$id]['icmptype']; + else if (isset($filterent['icmptype'])) + unset($filterent['icmptype']); $filterent['source'] = $a_filter[$id]['source']; $filterent['destination'] = $a_filter[$id]['destination']; $filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id']; @@ -611,19 +625,41 @@ include("head.inc"); </td> </tr> <?php endif; ?> +<?php $edit_disabled = ""; ?> +<?php if( isset($pconfig['associated-rule-id']) ): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Associated filter rule");?></td> + <td width="78%" class="vtable"> + <span class="red"><strong><?=gettext("NOTE: ");?></strong></span><?=gettext("This is associated to a NAT rule.");?><br /> + <?=gettext("You cannot edit the interface, protocol, source, or destination of associated filter rules.");?><br /> + <br /> + <?php + $edit_disabled = "disabled"; + if (is_array($config['nat']['rule'])) { + foreach( $config['nat']['rule'] as $index => $nat_rule ) { + if( isset($nat_rule['associated-rule-id']) && $nat_rule['associated-rule-id']==$pconfig['associated-rule-id'] ) { + echo "<a href=\"firewall_nat_edit.php?id={$index}\">" . gettext("View the NAT rule") . "</a><br>"; + break; + } + } + } + echo "<input name='associated-rule-id' id='associated-rule-id' type='hidden' value='{$pconfig['associated-rule-id']}' >"; + if (!empty($pconfig['interface'])) + echo "<input name='interface' id='interface' type='hidden' value='{$pconfig['interface']}' >"; + ?> + <script type="text/javascript"> + editenabled = 0; + </script> + </td> + </tr> +<?php endif; ?> <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Interface");?></td> <td width="78%" class="vtable"> -<?php $disabled = ""; - if (isset($pconfig['associated-rule-id'])) { - $disabled = "disabled"; - if (!empty($pconfig['interface'])) - echo "<input name='interface' id='interface' type='hidden' value='{$pconfig['interface']}' >"; - } - if ($if == "FloatingRules" || isset($pconfig['floating'])): ?> - <select name="interface[]" multiple="true" class="formselect" size="3" <?=$disabled;?>> +<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?> + <select name="interface[]" multiple="true" class="formselect" size="3" <?=$edit_disabled;?>> <?php else: ?> - <select name="interface" class="formselect" <?=$disabled;?>> + <select name="interface" class="formselect" <?=$edit_disabled;?>> <?php endif; /* add group interfaces */ @@ -684,7 +720,7 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td> <td width="78%" class="vtable"> - <select name="proto" class="formselect" onchange="proto_change()"> + <select <?=$edit_disabled;?> name="proto" class="formselect" onchange="proto_change()"> <?php $protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IGMP any carp pfsync"); foreach ($protocols as $proto): ?> @@ -698,7 +734,7 @@ include("head.inc"); <tr id="icmpbox" name="icmpbox"> <td valign="top" class="vncell"><?=gettext("ICMP type");?></td> <td class="vtable"> - <select name="icmptype" class="formselect"> + <select <?=$edit_disabled;?> name="icmptype" class="formselect"> <?php $icmptypes = array( "" => gettext("any"), @@ -731,28 +767,7 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Source");?></td> <td width="78%" class="vtable"> - <?php $edit_disabled=false; ?> - <?php if( isset($pconfig['associated-rule-id']) ): ?> - <span class="red"><strong><?=gettext("NOTE: ");?></strong></span><?=gettext("This is associated to a NAT rule.");?><br /> - <?=gettext("You cannot edit the source and destination of associated filter rules.");?><br /> - <br /> - <?php - $edit_disabled=true; - if (is_array($config['nat']['rule'])) { - foreach( $config['nat']['rule'] as $index => $nat_rule ) { - if( isset($nat_rule['associated-rule-id']) && $nat_rule['associated-rule-id']==$pconfig['associated-rule-id'] ) { - printf("<a href=\"firewall_nat_edit.php?id=%s\">%s</a><br>", $index, gettext("View the NAT rule")); - break; - } - } - } - ?> - <br /> - <script type="text/javascript"> - editenabled = 0; - </script> - <?php endif; ?> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>> + <input <?=$edit_disabled;?> name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>> <strong><?=gettext("not");?></strong> <br /> <?=gettext("Use this option to invert the sense of the match.");?> @@ -762,7 +777,7 @@ include("head.inc"); <tr> <td><?=gettext("Type:");?> </td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srctype" class="formselect" onChange="typesel_change()"> + <select <?=$edit_disabled;?> name="srctype" class="formselect" onChange="typesel_change()"> <?php $sel = is_specialnet($pconfig['src']); ?> <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>><?=gettext("any");?></option> @@ -792,8 +807,8 @@ include("head.inc"); <tr> <td><?=gettext("Address:");?> </td> <td> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> / - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcmask" class="formselect" id="srcmask"> + <input <?=$edit_disabled;?> autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> / + <select <?=$edit_disabled;?> name="srcmask" class="formselect" id="srcmask"> <?php for ($i = 31; $i > 0; $i--): ?> <option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option> <?php endfor; ?> @@ -803,7 +818,7 @@ include("head.inc"); </table> <div id="showadvancedboxspr"> <p> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> type="button" onClick="show_source_port_range()" value="<?=gettext("Advanced"); ?>"></input> - <?=gettext("Show source port range");?></a> + <input <?=$edit_disabled;?> type="button" onClick="show_source_port_range()" value="<?=gettext("Advanced"); ?>"></input> - <?=gettext("Show source port range");?></a> </div> </td> </tr> @@ -814,27 +829,27 @@ include("head.inc"); <tr> <td><?=gettext("from:");?> </td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()"> + <select <?=$edit_disabled;?> name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()"> <option value="">(<?=gettext("other"); ?>)</option> <option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>><?=gettext("any");?></option> <?php foreach ($wkports as $wkport => $wkportdesc): ?> <option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option> <?php endforeach; ?> </select> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>"> + <input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>"> </td> </tr> <tr> <td><?=gettext("to:");?></td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcendport" class="formselect" onchange="ext_change()"> + <select <?=$edit_disabled;?> name="srcendport" class="formselect" onchange="ext_change()"> <option value="">(<?=gettext("other"); ?>)</option> <option value="any" <?php $bfound = 0; if ($pconfig['srcendport'] == "any") { echo "selected"; $bfound = 1; } ?>><?=gettext("any");?></option> <?php foreach ($wkports as $wkport => $wkportdesc): ?> <option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option> <?php endforeach; ?> </select> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>"> + <input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>"> </td> </tr> </table> @@ -845,7 +860,7 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Destination");?></td> <td width="78%" class="vtable"> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>> + <input <?=$edit_disabled;?> name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>> <strong><?=gettext("not");?></strong> <br /> <?=gettext("Use this option to invert the sense of the match.");?> @@ -855,7 +870,7 @@ include("head.inc"); <tr> <td><?=gettext("Type:");?> </td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dsttype" class="formselect" onChange="typesel_change()"> + <select <?=$edit_disabled;?> name="dsttype" class="formselect" onChange="typesel_change()"> <?php $sel = is_specialnet($pconfig['dst']); ?> <option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>><?=gettext("any");?></option> @@ -885,9 +900,9 @@ include("head.inc"); <tr> <td><?=gettext("Address:");?> </td> <td> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>"> + <input <?=$edit_disabled;?> name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>"> / - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstmask" class="formselect" id="dstmask"> + <select <?=$edit_disabled;?> name="dstmask" class="formselect" id="dstmask"> <?php for ($i = 31; $i > 0; $i--): ?> <option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option> @@ -905,27 +920,27 @@ include("head.inc"); <tr> <td><?=gettext("from:");?> </td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()"> + <select <?=$edit_disabled;?> name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()"> <option value="">(<?=gettext("other"); ?>)</option> <option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>><?=gettext("any");?></option> <?php foreach ($wkports as $wkport => $wkportdesc): ?> <option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected"; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option> <?php endforeach; ?> </select> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo $pconfig['dstbeginport']; ?>"> + <input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo $pconfig['dstbeginport']; ?>"> </td> </tr> <tr> <td><?=gettext("to:");?></td> <td> - <select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstendport" class="formselect" onchange="ext_change()"> + <select <?=$edit_disabled;?> name="dstendport" class="formselect" onchange="ext_change()"> <option value="">(<?=gettext("other"); ?>)</option> <option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected"; $bfound = 1; } ?>><?=gettext("any");?></option> <?php foreach ($wkports as $wkport => $wkportdesc): ?> <option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option> <?php endforeach; ?> </select> - <input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo $pconfig['dstendport']; ?>"> + <input <?=$edit_disabled;?> autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo $pconfig['dstendport']; ?>"> </td> </tr> </table> diff --git a/usr/local/www/firewall_shaper_layer7.php b/usr/local/www/firewall_shaper_layer7.php index 2f93f80..a73506d 100755 --- a/usr/local/www/firewall_shaper_layer7.php +++ b/usr/local/www/firewall_shaper_layer7.php @@ -62,7 +62,7 @@ $statusurl = "status_queues.php"; $output_form = ""; $default_layer7shaper_msg = "<tr><td colspan=\"4\">"; -$default_layer7shaper_msg .= sprintf("<p><span class=\"vexpl\"><span class=\"red\"><strong>%s:<br>", gettext("Note")); +$default_layer7shaper_msg .= "<p><span class=\"vexpl\"><span class=\"red\"><strong>" . gettext("Note") . ":<br>"; $default_layer7shaper_msg .= "</strong></span>" . gettext("You can add new layer7 protocol patterns by simply uploading the file") . " <a href=\"diag_patterns.php\">" . gettext("here") . ".</a><br>"; $default_layer7shaper_msg .= "</td></tr>"; diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index b3a2cec..2958657 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -149,7 +149,7 @@ if ($_POST) { } else if ($parent_sn != $_POST['subnet_bits']) $input_errors[] = gettext("Subnet bits needs to be the same as the parent interface."); - if ($a_vip[$id]['vhid'] != $_POST['vhid']) + if (isset($id) && ($a_vip[$id]) && $a_vip[$id]['vhid'] != $_POST['vhid']) interface_vip_bring_down($a_vip[$id]); } diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 9330021..1a7503a 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -178,7 +178,7 @@ $pconfig['enable'] = isset($wancfg['enable']); if (is_array($config['aliases']['alias'])) { foreach($config['aliases']['alias'] as $alias) { if($alias['name'] == $wancfg['descr']) { - $input_errors[] = sprintf(gettext("Sorry, an alias with the name '%s' already exists."),$wancfg['descr']); + $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']); } } } @@ -275,6 +275,7 @@ if (isset($wancfg['wireless'])) { $pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']); $pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase']; $pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']); + $pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']); $pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw']; $pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']); } @@ -745,6 +746,10 @@ function handle_wireless_post() { $wancfg['wireless']['wpa']['mac_acl_enable'] = true; else if (isset($wancfg['wireless']['wpa']['mac_acl_enable'])) unset($wancfg['wireless']['wpa']['mac_acl_enable']); + if ($_POST['rsn_preauth'] == "yes") + $wancfg['wireless']['wpa']['rsn_preauth'] = true; + else + unset($wancfg['wireless']['wpa']['rsn_preauth']); if ($_POST['ieee8021x'] == "yes") $wancfg['wireless']['wpa']['ieee8021x']['enable'] = true; else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable'])) @@ -832,7 +837,7 @@ function check_wireless_mode() { $old_wireless_mode = $wancfg['wireless']['mode']; $wancfg['wireless']['mode'] = $_POST['mode']; if (!interface_wireless_clone("{$wlanif}_", $wancfg)) { - $input_errors[] = sprintf(gettext("Unable to change mode to %s . You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$wancfg['wireless']['mode']]); + $input_errors[] = sprintf(gettext("Unable to change mode to %s. You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$wancfg['wireless']['mode']]); } else { mwexec("/sbin/ifconfig {$wlanif}_ destroy"); } @@ -840,7 +845,7 @@ function check_wireless_mode() { } } -$pgtitle = array(gettext("Interfaces"),sprintf(gettext("'%s'"),$pconfig['descr'])); +$pgtitle = array(gettext("Interfaces"), $pconfig['descr']); $statusurl = "status_interfaces.php"; $closehead = false; @@ -1010,7 +1015,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" <form action="interfaces.php" method="post" name="iform" id="iform"> <?php if ($input_errors) print_input_errors($input_errors); ?> <?php if (is_subsystem_dirty('interfaces')): ?><p> - <?php print_info_box_np(sprintf(gettext("The '%s' configuration has been changed."),$wancfg['descr'])."<p>".gettext("You must apply the changes in order for them to take effect.")."<p>".gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?><br /> + <?php print_info_box_np(sprintf(gettext("The %s configuration has been changed."),$wancfg['descr'])."<p>".gettext("You must apply the changes in order for them to take effect.")."<p>".gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?><br /> <?php endif; ?> <?php if ($savemsg) print_info_box($savemsg); ?> <table width="100%" border="0" cellpadding="6" cellspacing="0"> @@ -1178,7 +1183,8 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" </tr> <tr><td> </td> <tr> - <td colspan="2"> + <td> </td> + <td> <center> <div id='savebuttondiv'> <input type="hidden" name="addrtype" id="addrtype" value="IPv4" /> @@ -1948,6 +1954,13 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" <br/> </td> </tr> + <tr> + <td valign="top" class="vncell">802.1X <?=gettext("Authentication Roaming Preauth"); ?></td> + <td class="vtable"> + <input name="rsn_preauth" id="rsn_preauth" type="checkbox" class="formfld unknown" size="66" value="yes" <? if ($pconfig['rsn_preauth']) echo "checked"; ?>> + <br/> + </td> + </tr> <?php endif; ?> <tr> <td colspan="2" valign="top" height="16"></td> @@ -1979,10 +1992,6 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" "and obviously should not appear as the source address in any packets you receive."); ?> </td> </tr> - </table> <!-- End "allcfg" table --> - </div> <!-- End "allcfg" div --> - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="100" valign="top"> @@ -1998,7 +2007,8 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" <input name="ptpid" type="hidden" value="<?=$pconfig['ptpid'];?>"> </td> </tr> - </table> + </table> <!-- End "allcfg" table --> + </div> <!-- End "allcfg" div --> </td> </tr> </table> diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 9addbfa..565245b 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -182,9 +182,9 @@ if ($_POST['apply']) { /* Deliver error message for any port with more than one assignment */ foreach ($portifmap as $portname => $ifnames) { if (count($ifnames) > 1) { - $errstr = sprintf(gettext("Port '%s' ". - " was assigned to '%s'" . - " interfaces:"), $portname, count($ifnames)); + $errstr = sprintf(gettext('Port %1$s '. + ' was assigned to %2$s' . + ' interfaces:'), $portname, count($ifnames)); foreach ($portifmap[$portname] as $ifn) $errstr .= " " . $ifn; @@ -425,11 +425,11 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed")) <tr> <td class="listlr" valign="middle"><strong><?=$ifdescr;?></strong></td> <td valign="middle" class="listr"> - <select name="<?=$ifname;?>" id="<?=$ifname;?>"> + <select onChange="javascript:$('savediv').appear();" name="<?=$ifname;?>" id="<?=$ifname;?>"> <?php foreach ($portlist as $portname => $portinfo): ?> - <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected";?>> + <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected";?>> <?php if ($portinfo['isvlan']) { - $descr = sprintf(gettext("VLAN '%s' on '%s'"),$portinfo['tag'],$portinfo['if']); + $descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']); if ($portinfo['descr']) $descr .= " (" . $portinfo['descr'] . ")"; echo htmlspecialchars($descr); @@ -490,8 +490,10 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed")) </table> </div> <br/> -<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"><br><br> -<p> +<div name='savediv' id='savediv' style='display:none;'> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"><br><br> + <p> +</div> </p> <ul> <li><span class="vexpl"><?=gettext("change the IP address of your computer"); ?></span></li> diff --git a/usr/local/www/interfaces_wireless_edit.php b/usr/local/www/interfaces_wireless_edit.php index 4108413..c5c511a 100644 --- a/usr/local/www/interfaces_wireless_edit.php +++ b/usr/local/www/interfaces_wireless_edit.php @@ -120,7 +120,7 @@ if ($_POST) { } if (!$input_errors) { if (!interface_wireless_clone($clone['cloneif'], $clone)) { - $input_errors[] = sprintf(gettext("Error creating interface with mode %s. The %s interface may not support creating more clones with the selected mode."), $wlan_modes[$clone['mode']], $clone['if']); + $input_errors[] = sprintf(gettext('Error creating interface with mode %1$s. The %2$s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']); } else { if (isset($id) && $a_clones[$id]) { if ($clone['if'] != $a_clones[$id]['if']) diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index 3556b4c..92453b9 100755 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -176,8 +176,8 @@ function clearcombo(){ <td width="22%" valign="top" class="vncellreq"><?=gettext("Mode"); ?></td> <td width="78%" class="vtable" colspan="2"> <select id="mode" name="mode" onChange="enforceFailover(); checkPoolControls();"> - <option value="loadbalance" <?if(!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "value=\"{$pconfig['name']}\"";?>><?=gettext("Load Balance"); ?></option> - <option value="failover" <?if($pconfig['mode'] == "failover") echo "value=\"{$pconfig['name']}\"";?>><?=gettext("Manual Failover"); ?></option> + <option value="loadbalance" <?if(!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "selected";?>><?=gettext("Load Balance");?></option> + <option value="failover" <?if($pconfig['mode'] == "failover") echo "selected";?>><?=gettext("Manual Failover");?></option> </select> </td> </tr> @@ -226,7 +226,7 @@ function clearcombo(){ <td width="22%" valign="top" class="vncellreq"><?=gettext("Server IP Address"); ?></td> <td width="78%" class="vtable" colspan="2"> <input name="ipaddr" type="text" size="16" style="float: left;"> - <input class="formbtn" type="button" name="button1" value="<?=gettext("Add to pool"); ?>" onclick="AddServerToPool(document.iform);"><br> + <input class="formbtn" type="button" name="button1" value="<?=gettext("Add to pool"); ?>" onclick="AddServerToPool(document.iform); enforceFailover(); checkPoolControls();"><br> </td> </tr> <tr> diff --git a/usr/local/www/pkg_mgr.php b/usr/local/www/pkg_mgr.php index efdc085..7500489 100755 --- a/usr/local/www/pkg_mgr.php +++ b/usr/local/www/pkg_mgr.php @@ -57,7 +57,7 @@ if($pkg_info) { $savemsg = sprintf(gettext("Unable to retrieve package info from %s. Cached data will be used."), $xmlrpc_base_url); $pkg_info = unserialize(@file_get_contents("{$g['tmp_path']}/pkg_info.cache")); } else { - $savemsg = sprintf(gettext("Unable to communicate with %s. Please verify DNS and interface configuration, and that %s has functional Internet connectivity."), $xmlrpc_base_url, $g['product_name']); + $savemsg = sprintf(gettext('Unable to communicate with %1$s. Please verify DNS and interface configuration, and that %2$s has functional Internet connectivity.'), $xmlrpc_base_url, $g['product_name']); } } diff --git a/usr/local/www/pkg_mgr_settings.php b/usr/local/www/pkg_mgr_settings.php index 14a5a33..c3d0ce5 100644 --- a/usr/local/www/pkg_mgr_settings.php +++ b/usr/local/www/pkg_mgr_settings.php @@ -109,7 +109,7 @@ function enable_altpkgrepourl(enable_over) { <tr><td><?=gettext("Base URL:");?></td><td><input name="pkgrepourl" type="input" class="formfld url" id="pkgrepourl" size="64" value="<?php if($curcfg['xmlrpcbaseurl']) echo $curcfg['xmlrpcbaseurl']; else echo $g['']; ?>"></td></tr> </table> <span class="vexpl"> - <?=sprintf(gettext("This is where %s will check for packages when the"),$g['product_name']);?>, <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed.");?> + <?=printf(gettext("This is where %s will check for packages when the"),$g['product_name']);?>, <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed");?>. </span> </td> </tr> diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index b3b2f97..08adf7d 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -117,9 +117,10 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); /* make sure no interfaces are bridged */ - foreach ($pconfig['cinterface'] as $cpbrif) - if (link_interface_to_bridge($cpbrif)) - $input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif); + if (is_array($_POST['cinterface'])) + foreach ($pconfig['cinterface'] as $cpbrif) + if (link_interface_to_bridge($cpbrif)) + $input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif); if ($_POST['httpslogin_enable']) { if (!$_POST['cert'] || !$_POST['key']) { @@ -169,7 +170,8 @@ if ($_POST) { } if (!$input_errors) { - $config['captiveportal']['interface'] = implode(",", $_POST['cinterface']); + if (is_array($_POST['cinterface'])) + $config['captiveportal']['interface'] = implode(",", $_POST['cinterface']); $config['captiveportal']['maxproc'] = $_POST['maxproc']; $config['captiveportal']['maxprocperip'] = $_POST['maxprocperip'] ? $_POST['maxprocperip'] : false; $config['captiveportal']['timeout'] = $_POST['timeout']; @@ -222,7 +224,8 @@ if ($_POST) { $savemsg = get_std_save_message($retval); - $pconfig['cinterface'] = implode(",", $_POST['cinterface']); + if (is_array($_POST['cinterface'])) + $pconfig['cinterface'] = implode(",", $_POST['cinterface']); } } include("head.inc"); diff --git a/usr/local/www/services_captiveportal_vouchers_edit.php b/usr/local/www/services_captiveportal_vouchers_edit.php index 932837e..96e563f 100644 --- a/usr/local/www/services_captiveportal_vouchers_edit.php +++ b/usr/local/www/services_captiveportal_vouchers_edit.php @@ -116,7 +116,7 @@ if ($_POST) { $rollent['active'] = array(); voucher_write_used_db($rollent['number'], $rollent['used']); voucher_write_active_db($rollent['number'], array()); // create empty DB - voucher_log(LOG_INFO,printf(gettext("All %s vouchers from Roll %s marked unused"), $rollent['count'], $rollent['number'])); + voucher_log(LOG_INFO,sprintf(gettext('All %1$s vouchers from Roll %2$s marked unused'), $rollent['count'], $rollent['number'])); } else { // existing roll has been modified but without changing the count // read active and used DB from ramdisk and store it in XML config diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 729f324..086e38d 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -248,7 +248,7 @@ if ($_POST) { foreach($config['virtualip']['vip'] as $vip) { if($vip['interface'] == $if) if($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) - $input_errors[] = printf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']); + $input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']); } } @@ -274,7 +274,7 @@ if ($_POST) { /* make sure that the DHCP Relay isn't enabled on this interface */ if (isset($config['dhcrelay'][$if]['enable'])) - $input_errors[] = printf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]); + $input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]); } } diff --git a/usr/local/www/services_wol.php b/usr/local/www/services_wol.php index e95f118..128fc3f 100755 --- a/usr/local/www/services_wol.php +++ b/usr/local/www/services_wol.php @@ -58,10 +58,10 @@ if($_GET['wakeall'] <> "") { get_interface_subnet($if)); /* Execute wol command and check return code. */ if(!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")){ - $savemsg .= sprintf(gettext("Sent magic packet to %s (%s)%s"),$mac, $description, ".<br>"); + $savemsg .= sprintf(gettext('Sent magic packet to %1$s (%2$s)%3$s'),$mac, $description, ".<br>"); } else { - $savemsg .= sprintf(gettext("Please check the %ssystem log%s, the wol command for %s (%s) did not complete successfully%s"),'<a href=\"/diag_logs.php\">','</a>',$description,$mac,".<br>"); + $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s (%4$s) did not complete successfully%5$s'),'<a href="/diag_logs.php">','</a>',$description,$mac,".<br>"); } } } @@ -96,7 +96,7 @@ if ($_POST || $_GET['mac']) { $savemsg .= sprintf(gettext("Sent magic packet to %s."),$mac); } else { - $savemsg .= sprintf(gettext("Please check the %ssystem log%s, the wol command for %s did not complete successfully%s"),'<a href=\"/diag_logs.php\">', '</a>', $mac, ".<br>"); + $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s did not complete successfully%4$s'),'<a href="/diag_logs.php">', '</a>', $mac, ".<br>"); } } } diff --git a/usr/local/www/status_gateway_groups.php b/usr/local/www/status_gateway_groups.php index f70f539..f8d29de 100755 --- a/usr/local/www/status_gateway_groups.php +++ b/usr/local/www/status_gateway_groups.php @@ -97,7 +97,7 @@ include("head.inc"); echo "<tr>"; foreach($priorities as $number => $tier) { - printf(gettext("%sTier %s%s"), "<td width='120'>", $number, "</td>"); + echo "<td width='120'>" . sprintf(gettext("Tier %s"), $number) . "</td>"; } echo "</tr>\n"; diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php index 47eb31d..b288bd8 100755 --- a/usr/local/www/status_lb_pool.php +++ b/usr/local/www/status_lb_pool.php @@ -28,7 +28,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_MODULE: routing */ @@ -39,7 +39,10 @@ ##|*MATCH=status_lb_pool.php* ##|-PRIV -require("guiconfig.inc"); +require_once("guiconfig.inc"); +require_once("functions.inc"); +require_once("filter.inc"); +require_once("shaper.inc"); if (!is_array($config['load_balancer']['lbpool'])) { $config['load_balancer']['lbpool'] = array(); @@ -50,7 +53,7 @@ $lb_logfile = "{$g['varlog_path']}/relayd.log"; $nentries = $config['syslog']['nentries']; if (!$nentries) - $nentries = 50; + $nentries = 50; $now = time(); $year = date("Y"); @@ -63,13 +66,53 @@ $relay_hosts=Array(); foreach( (array) $relayctl as $line) { $t=split("\t", $line); switch (trim($t[1])) { - case "table": - $curpool=trim($t[2]); - break; - case "host": - $curhost=trim($t[2]); - $relay_hosts[$curpool][$curhost]['state']=trim($t[4]); - break; + case "table": + $curpool=trim($t[2]); + break; + case "host": + $curhost=trim($t[2]); + $relay_hosts[$curpool][$curhost]['state']=trim($t[4]); + break; + } +} + +if ($_POST) { + if ($_POST['apply']) { + $retval = 0; + $retval |= filter_configure(); + $retval |= relayd_configure(); + $savemsg = get_std_save_message($retval); + clear_subsystem_dirty('loadbalancer'); + } else { + /* Keep a list of servers we find in POST variables */ + $newservers = array(); + foreach ($_POST as $name => $value) { + /* Look through the POST vars to find the pool data */ + if (strpos($name, '|') !== false){ + list($poolname, $ip) = explode("|", $name); + $ip = str_replace('_', '.', $ip); + $newservers[$poolname][] = $ip; + } elseif (is_ipaddr($value)) { + $newservers[$name][] = $value; + } + } + foreach ($a_pool as & $pool) { + if (is_array($pool['servers']) && is_array($pool['serversdisabled'])) { + $oldservers = array_merge($pool['servers'], $pool['serversdisabled']); + } elseif (is_array($pool['servers'])) { + $oldservers = $pool['servers']; + } elseif (is_array($pool['serversdisabled'])) { + $oldservers = $pool['serversdisabled']; + } else { + $oldservers = array(); + } + if (is_array($newservers[$pool['name']])) { + $pool['servers'] = $newservers[$pool['name']]; + $pool['serversdisabled'] = array_diff($oldservers, $newservers[$pool['name']]); + } + } + mark_subsystem_dirty('loadbalancer'); + write_config("Updated load balancer pools via status screen."); } } @@ -77,146 +120,114 @@ foreach( (array) $relayctl as $line) { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <script src="/javascript/sorttable.js"></script> <?php include("fbegin.inc"); ?> +<form action="status_lb_pool.php" method="POST"> +<?php if (is_subsystem_dirty('loadbalancer')): ?><p> +<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br>"));?><br> +<?php endif; ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> - <?php - /* active tabs */ - $tab_array = array(); - $tab_array[] = array(gettext("Pools"), true, "status_lb_pool.php"); - $tab_array[] = array(gettext("Virtual Servers"), false, "status_lb_vs.php"); - display_top_tabs($tab_array); - ?> - </td></tr> - <tr> - <td> + <tr><td class="tabnavtbl"> + <?php + /* active tabs */ + $tab_array = array(); + $tab_array[] = array(gettext("Pools"), true, "status_lb_pool.php"); + $tab_array[] = array(gettext("Virtual Servers"), false, "status_lb_vs.php"); + display_top_tabs($tab_array); + ?> + </td></tr> + <tr> + <td> <div id="mainarea"> - <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" name="sortabletable" id="sortabletable"> - <tr> - <td width="10%" class="listhdrr"><?=gettext("Name");?></td> - <td width="10%" class="listhdrr"><?=gettext("Mode");?></td> - <td width="10%" class="listhdrr"><?=gettext("Servers");?></td> - <td width="10%" class="listhdrr"><?=gettext("Monitor");?></td> - <td width="30%" class="listhdr"><?=gettext("Description");?></td> - </tr> - <?php $i = 0; foreach ($a_pool as $vipent): - ?> - <tr> - <td class="listlr"> - <?=$vipent['name'];?> - </td> - <td class="listr" align="center" > - <?php - switch($vipent['mode']) { - case "loadbalance": - echo "Load balancing"; - break; - case "failover": - echo "Manual failover"; - break; - default: - echo "(default)"; - } - ?> - </td> - <td class="listr" align="center" > - <table border="0" cellpadding="0" cellspacing="2"> - <?php - foreach ((array) $vipent['servers'] as $server) { - $svr = split("\|", $server); - if($svr[0]!="") { - switch ($relay_hosts[$vipent['name'].":".$vipent['port']][$svr[0]]['state']) { - case 'up': - $bgcolor = "lightgreen"; - break; - default: - $bgcolor = "lightcoral"; - } - PRINT "<tr>"; - switch ($vipent['mode']) { - case 'loadbalance': - if($svr[0]!="") PRINT "<td><input type='checkbox' name='".$vipent['name']."_".$svr[0]."' checked></td>"; - break; - case 'failover': - if($svr[0]!="") PRINT "<td><input type='radio' name='".$vipent['name']."' checked></td>"; - break; - } - PRINT "<td bgcolor=".$bgcolor."> {$svr[0]}:{$vipent['port']} </td></tr>"; - } - } - foreach ((array) $vipent['serversdisabled'] as $server) { - $svr = split("\|", $server); - - PRINT "<tr>"; - switch ($vipent['mode']) { - case 'loadbalance': - if($svr[0]!="") PRINT "<td><input type='checkbox' name='".$vipent['name']."_".$svr[0]."'></td>"; + <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" name="sortabletable" id="sortabletable"> + <tr> + <td width="10%" class="listhdrr"><?=gettext("Name");?></td> + <td width="10%" class="listhdrr"><?=gettext("Mode");?></td> + <td width="10%" class="listhdrr"><?=gettext("Servers");?></td> + <td width="10%" class="listhdrr"><?=gettext("Monitor");?></td> + <td width="30%" class="listhdr"><?=gettext("Description");?></td> + </tr> + <?php foreach ($a_pool as & $pool): ?> + <tr> + <td class="listlr"> + <?=$pool['name'];?> + </td> + <td class="listr" align="center" > + <?php + switch($pool['mode']) { + case "loadbalance": + echo "Load balancing"; + break; + case "failover": + echo "Manual failover"; + break; + default: + echo "(default)"; + } + ?> + </td> + <td class="listr" align="center" > + <table border="0" cellpadding="0" cellspacing="2"> + <?php + $pool_hosts=array(); + foreach ((array) $pool['servers'] as $server) { + $svr['ip']['addr']=$server; + $svr['ip']['state']=$relay_hosts[$pool['name'].":".$pool['port']][$server['ip']]['state']; + $pool_hosts[]=$svr; + } + foreach ((array) $pool['serversdisabled'] as $server) { + $svr['ip']['addr']="$server"; + $svr['ip']['state']='disabled'; + $pool_hosts[]=$svr; + } + asort($pool_hosts); + + foreach ((array) $pool_hosts as $server) { + if($server['ip']['addr']!="") { + switch ($server['ip']['state']) { + case 'up': + $bgcolor = "lightgreen"; + $checked = "checked"; break; - case 'failover': - if($svr[0]!="") PRINT "<td><input type='radio' name='".$vipent['name']."'></td>"; + case 'disabled': + $bgcolor = "white"; + $checked = ""; break; - } - PRINT "<td> {$svr[0]}:{$vipent['port']} </td></tr>"; + default: + $bgcolor = "lightcoral"; + $checked = "checked"; } - ?> - </table> - </td> - <td class="listr" > - <table border="0" cellpadding="0" cellspacing="2"> - <?php - if ($vipent['type'] == "gateway") { - $poolfile = "{$g['tmp_path']}/{$vipent['name']}.pool"; - if(file_exists("$poolfile")) { - $poolstatus = file_get_contents("$poolfile"); - } - foreach ((array) $vipent['servers'] as $server) { - $lastchange = ""; - $svr = split("\|", $server); - $monitorip = $svr[1]; - $logstates = return_clog($lb_logfile, $nentries, true, array("$monitorip", "marking"), "", true); - - $logstates = $logstates[0]; - - if(stristr($logstates, $monitorip)) { - $date = preg_split("/[ ]+/" , $logstates); - $lastchange = "$date[0] $date[1] $year $date[2]"; - } - if(stristr($poolstatus, $monitorip)) { - $online = gettext("Online"); - $bgcolor = "lightgreen"; - $change = $now - strtotime("$lastchange"); - if($change < 300) { - $bgcolor = "khaki"; - } - } else { - $online = gettext("Offline"); - $bgcolor = "lightcoral"; - } - PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>"; - if($lastchange <> "") { - PRINTF(gettext("Last change %s"),$lastchange); - } else { - PRINT(gettext("No changes found in logfile")); - } - PRINT "</td></tr>"; - } - } else { - PRINT "<tr><td> {$vipent['monitor']} </td></tr>"; - } - ?> - </table> - </td> - <td class="listbg" > - <?=$vipent['desc'];?> - </td> - </tr> - <?php - $i++; - endforeach; - ?> - </table> - </div> + echo "<tr>"; + switch ($pool['mode']) { + case 'loadbalance': + echo "<td><input type='checkbox' name='{$pool['name']}|".str_replace('.', '_', $server['ip']['addr'])."' {$checked}></td>\n"; + break; + case 'failover': + echo "<td><input type='radio' name='{$pool['name']}' value='{$server['ip']['addr']}' {$checked}></td>\n"; + break; + } + echo "<td bgcolor={$bgcolor}> {$server['ip']['addr']}:{$pool['port']} </td></tr>"; + } + } + ?> + </table> + </td> + <td class="listr" > + <?php echo $pool['monitor']; ?> + </td> + <td class="listbg" > + <?=$pool['desc'];?> + </td> + </tr> + <?php endforeach; ?> + <tr> + <td colspan="5"> + <input name="Submit" type="submit" class="formbtn" value="<?= gettext("Save"); ?>"> + <input name="Reset" type="reset" class="formbtn" value="<?= gettext("Reset"); ?>"> + </td> + </tr> + </table> + </div> </table> - +</form> <?php include("fend.inc"); ?> </body> </html> diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index bc974b1..4e7b887 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -189,7 +189,7 @@ $rrdcolors = "./themes/{$g['theme']}/rrdcolors.inc.php"; if(file_exists($rrdcolors)) { include($rrdcolors); } else { - log_error(printf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme'])); + log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme'])); $colortrafficup = array("666666", "CCCCCC"); $colortrafficdown = array("990000", "CC0000"); $colorpacketsup = array("666666", "CCCCCC"); @@ -910,7 +910,7 @@ elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curda } else { $data = false; - log_error(printf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); + log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); } /* check modification time to see if we need to generate image */ @@ -930,16 +930,16 @@ if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) { usleep(500); } if(($graphcmdreturn <> 0) || (! $data)) { - log_error(printf(gettext("Failed to create graph with error code %s, the error is: %s"),$graphcmdreturn,$graphcmdoutput)); + log_error(sprintf(gettext('Failed to create graph with error code %1$s, the error is: %2$s'),$graphcmdreturn,$graphcmdoutput)); if(strstr($curdatabase, "queues")) { - log_error(printf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase)); + log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase)); exec("/bin/rm -f $rrddbpath$curif$queues"); flush(); usleep(500); enable_rrd_graphing(); } if(strstr($curdatabase, "queuesdrop")) { - log_error(printf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase)); + log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase)); exec("/bin/rm -f $rrddbpath$curdatabase"); flush(); usleep(500); diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php index 4e2a313..0aa56ba 100755 --- a/usr/local/www/status_wireless.php +++ b/usr/local/www/status_wireless.php @@ -74,7 +74,7 @@ foreach($ciflist as $interface => $ifdescr) { $enabled = false; if($if == $interface) $enabled = true; - $tab_array[] = array(printf(gettext("Status (%s)"),$ifdescr), $enabled, "status_wireless.php?if={$interface}"); + $tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}"); } } $rwlif = get_real_interface($if); @@ -140,7 +140,7 @@ display_top_tabs($tab_array); /* table header */ print "\n<tr>"; - printf(gettext("%s%s%sAssociated or ad-hoc peers.%s%s%s%s"),'<tr>','<td colspan=7>','<b>','<br/>','</td>','</tr>','\n'); + print "<tr><td colspan=7><b>" . gettext("Associated or ad-hoc peers") . "<br/></td></tr>\n"; print "<tr bgcolor='#990000'>"; print "<td><b><font color='#ffffff'>ADDR</td>"; print "<td><b><font color='#ffffff'>AID</td>"; diff --git a/usr/local/www/system.php b/usr/local/www/system.php index 69a8f70..9a319b3 100755 --- a/usr/local/www/system.php +++ b/usr/local/www/system.php @@ -334,7 +334,7 @@ include("head.inc"); <?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?> </strong> <br/> - <?php sprintf(gettext("If this option is set, '%s' will " . + <?php printf(gettext("If this option is set, %s will " . "use DNS servers assigned by a DHCP/PPP server on WAN " . "for its own purposes (including the DNS forwarder). " . "However, they will not be assigned to DHCP and PPTP " . diff --git a/usr/local/www/system_advanced_admin.php b/usr/local/www/system_advanced_admin.php index 5245694..4cdf065 100644 --- a/usr/local/www/system_advanced_admin.php +++ b/usr/local/www/system_advanced_admin.php @@ -325,7 +325,7 @@ function prot_change() { <input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> /> <strong><?=gettext("Disable webConfigurator anti-lockout rule"); ?></strong> <br/> - <?php sprintf(gettext("When this is unchecked, access to the webConfigurator " . + <?php printf(gettext("When this is unchecked, access to the webConfigurator " . "on the %s interface is always permitted, regardless of the user-defined firewall " . "rule set. Check this box to disable this automatically added rule, so access " . "to the webConfigurator is controlled by the user-defined firewall rules " . diff --git a/usr/local/www/system_firmware_check.php b/usr/local/www/system_firmware_check.php index 8057a3c..cb80b6a 100755 --- a/usr/local/www/system_firmware_check.php +++ b/usr/local/www/system_firmware_check.php @@ -139,7 +139,7 @@ if (!$remote_version) { if(isset($curcfg['alturl']['enable'])) $static_text .= gettext("Could not contact custom update server.") . "\\n"; else - $static_text .= sprintf(gettext("Could not contact %s update server %s%s"), $g['product_name'], $updater_url, "\\n"); + $static_text .= sprintf(gettext('Could not contact %1$s update server %2$s%3$s'), $g['product_name'], $updater_url, "\\n"); } else { $static_text .= gettext("Obtaining current version information..."); update_output_window($static_text); diff --git a/usr/local/www/vpn_ipsec_phase1.php b/usr/local/www/vpn_ipsec_phase1.php index b72891c..b549ea0 100644 --- a/usr/local/www/vpn_ipsec_phase1.php +++ b/usr/local/www/vpn_ipsec_phase1.php @@ -163,7 +163,7 @@ if ($_POST) { if ($p1index <> $t) { $tremotegw = $pconfig['remotegw']; if (($ph1tmp['remote-gateway'] == $tremotegw) && !isset($ph1tmp['disabled'])) { - $input_errors[] = sprintf(gettext("The remote gateway \"%s\" is already used by phase1 \"${ph1tmp['descr']}\"."), $tremotegw); + $input_errors[] = sprintf(gettext('The remote gateway "%1$s" is already used by phase1 "%2$s".'), $tremotegw, $ph1tmp['descr']); } } $t++; diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 720c277..ff6ded1 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -74,7 +74,7 @@ if(empty($xml)) { } if (!is_array($pkg)) { - print_info_box_np(printf(gettext("ERROR: Could not parse %s/wizards/%s file."),$g['www_path'],$xml)); + print_info_box_np(sprintf(gettext("ERROR: Could not parse %s/wizards/%s file."),$g['www_path'],$xml)); die; } diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index 950469c..d7b7e88 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -158,7 +158,7 @@ function restore_config_section_xmlrpc($raw_params) { if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail']; $config = array_merge($config, $params[0]); $mergedkeys = implode(",", array_keys($params[0])); - write_config(printf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); + write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); return $xmlrpc_g['return']['true']; } @@ -181,7 +181,7 @@ function merge_installedpackages_section_xmlrpc($raw_params) { if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail']; $config['installedpackages'] = array_merge($config['installedpackages'], $params[0]); $mergedkeys = implode(",", array_keys($params[0])); - write_config(printf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); + write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); return $xmlrpc_g['return']['true']; } |